My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package u;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public abstract class Utils {

public interface IExecutor {
public void pre();
public void exec(String line);
public void post();
}

abstract static public class AbstractExecutor implements IExecutor{
public void pre(){}
public void exec(String line){}
public void post(){}
}

/**
* implement
* use BufferedReader
*
* @param file
* @param executor
* @return
* @throws IOException
*/
public static IExecutor readLine(File file, IExecutor executor)
throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(file));

try {
executor.pre();
String line = null;
while ((line = reader.readLine()) != null) {
executor.exec(line);
}

} finally {
try {
reader.close();
} finally {
executor.post();
}

}

return executor;
}



}

Change log

r49 by ugo.nakawaka on Sep 17, 2010   Diff
タイポ
Go to: 
Project members, sign in to write a code review

Older revisions

r47 by ugo.nakawaka on Sep 11, 2010   Diff
最初のコミット readLineを実装
All revisions of this file

File info

Size: 1170 bytes, 56 lines

File properties

svn:mime-type
text/plain
Powered by Google Project Hosting