forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFileStream.java
More file actions
executable file
·32 lines (30 loc) · 960 Bytes
/
TestFileStream.java
File metadata and controls
executable file
·32 lines (30 loc) · 960 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
/* */ package ch17;
/* */
/* */ import java.io.FileInputStream;
/* */ import java.io.FileOutputStream;
/* */ import java.io.IOException;
/* */
/* */ public class TestFileStream {
/* */ public static void main(String[] args) throws IOException {
/* 9 */ try (FileOutputStream output = new FileOutputStream("temp.dat")) {
/* */
/* */
/* 12 */ for (int i = 1; i <= 10; i++) {
/* 13 */ output.write(i);
/* */ }
/* */ }
/* */
/* */
/* 18 */ try (FileInputStream input = new FileInputStream("temp.dat")) {
/* */ int value;
/* */
/* */
/* 22 */ while ((value = input.read()) != -1)
/* 23 */ System.out.print(value + " ");
/* */ }
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch17/TestFileStream.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/