FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaSE/JavaIO/FileOutputStream_t.java at master · goder/JavaSE · GitHub
goder
JavaSE
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaSE
/
JavaIO
/
FileOutputStream_t.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (34 loc) · 793 Bytes
Breadcrumbs
JavaSE
/
JavaIO
/
FileOutputStream_t.java
Copy path
File metadata and controls
42 lines (34 loc) · 793 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* 功能:FileOutputStream类基本功能,读取文件,写出文件,每次读写一个字节
* 1、
*/
package
com
.
bj
.
io
;
import
java
.
io
.*;
public
class
FileOutputStream_t
{
public
static
void
main
(
String
[]
args
) {
//定义File对象
File
file
=
new
File
(
"D:/www/test.txt"
);
//字节输出流
FileOutputStream
fos
=
null
;
try
{
fos
=
new
FileOutputStream
(
file
);
//字符串
String
s
=
"I have a dream.
\r
\n
"
;
String
s1
=
"you have a dream."
;
//定义字节数组
//byte bytes[]=new byte[1024];
fos
.
write
(
s
.
getBytes
());
fos
.
write
(
s1
.
getBytes
());
}
catch
(
Exception
e
) {
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
finally
{
try
{
fos
.
close
();
}
catch
(
IOException
e
) {
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL