-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBufferedOutputStreamTest.java
More file actions
41 lines (34 loc) · 957 Bytes
/
Copy pathBufferedOutputStreamTest.java
File metadata and controls
41 lines (34 loc) · 957 Bytes
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
package javaIO;
import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class BufferedOutputStreamTest {
public static void main(String[] args) {
FileOutputStream fos = null;
BufferedOutputStream bos=null;
try {
fos = new FileOutputStream("/Users/choi/Desktop/dd.txt");
bos=new BufferedOutputStream(fos);
for(int i='a';i<='z';i++)
bos.write(i);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("File Not Fount:" + e);
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("IOException e:" + e);
e.printStackTrace();
System.out.println("File Not Fount:" + e);
} finally {
try {
if(fos!=null)
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}