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
| package Java0326.Lecture15.FileIO;
import java.io.InputStream;
import java.io.OutputStream;
public class FileClose {
public static void close(InputStream is) {
if(is != null) {
try {
is.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}
public static void close(OutputStream os) {
if(os != null) {
try {
os.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}
public static void close(InputStream bis, InputStream is) {
FileClose.close(bis);
FileClose.close(is);
}
public static void close(OutputStream bos, OutputStream os) {
FileClose.close(bos);
FileClose.close(os);
}
}
|