FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Lessons4JavaSE/src/unit06/TestFileStream.java at master · AlohaWorld/Lessons4JavaSE · GitHub
AlohaWorld
/
Lessons4JavaSE
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
19
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Lessons4JavaSE
/
src
/
unit06
/
TestFileStream.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (21 loc) · 695 Bytes
Breadcrumbs
Lessons4JavaSE
/
src
/
unit06
/
TestFileStream.java
Copy path
File metadata and controls
28 lines (21 loc) · 695 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
unit06
;
import
java
.
io
.*;
public
class
TestFileStream
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// Create an output stream to the file
FileOutputStream
output
=
new
FileOutputStream
(
"temp.dat"
);
// Output values to the file
for
(
int
i
=
1
;
i
<=
10
;
i
++)
output
.
write
(
i
);
// Close the output stream
output
.
close
();
// Create an input stream for the file
FileInputStream
input
=
new
FileInputStream
(
"temp.dat"
);
// Read values from the file
int
value
;
while
((
value
=
input
.
read
()) != -
1
)
System
.
out
.
print
(
value
+
" "
);
// Close the output stream
input
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL