-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
파일을 찾아다니는 Travler 와 파일을 이용하는 Processer 로 관심에 따른 코드 분리.
Processer 는 우선 문자열을 출력하는 FilePathPrinter 하나 만들어 둠. 그 외에 더이상 Main 으로 실행하고 있지 않아서 Main 클래스는 속을 비워 둠.
- Loading branch information
Showing
6 changed files
with
74 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package sangpire.findup; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* 뭔가 기가막힌 이름이 없을까? | ||
*/ | ||
public interface Processer { | ||
|
||
/** | ||
* 작업 시작했어요. 이제 파일 찾으러 갈 꺼예요. | ||
*/ | ||
void start(); | ||
|
||
/** | ||
* 여기 파일이요. | ||
* @param file 방금 찾은 파일. | ||
*/ | ||
void put(File file); | ||
|
||
/** | ||
* 다 찾아 줬어요. | ||
*/ | ||
void finish(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/sangpire/findup/processer/FilePathPrinter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package sangpire.findup.processer; | ||
|
||
import sangpire.findup.Processer; | ||
|
||
import java.io.File; | ||
|
||
public class FilePathPrinter implements Processer { | ||
|
||
@Override | ||
public void start() { | ||
System.out.println("START File Path Printing..."); | ||
} | ||
|
||
@Override | ||
public void put(File file) { | ||
String fileMetaInfos =String.format("[%s] %s\n", file.isDirectory() ? "d" : "-" , file.getAbsolutePath()); | ||
System.out.print(fileMetaInfos); | ||
} | ||
|
||
@Override | ||
public void finish() { | ||
System.out.println("FINISHED File Path Printing..."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters