FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaSE/JavaIO/BufferStream_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
/
BufferStream_t.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (36 loc) · 872 Bytes
Breadcrumbs
JavaSE
/
JavaIO
/
BufferStream_t.java
Copy path
File metadata and controls
43 lines (36 loc) · 872 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
43
/*
* 功能:缓存字符流基本用法,缓存字符流可以读取更多的字符,提高读取写入效率
*/
package
com
.
bj
.
io
;
import
java
.
io
.*;
public
class
BufferStream_t
{
public
static
void
main
(
String
[]
args
) {
// TODO Auto-generated method stub
BufferedReader
br
=
null
;
BufferedWriter
bw
=
null
;
try
{
//先创建FileReader
FileReader
fr
=
new
FileReader
(
"D:/www/test.txt"
);
br
=
new
BufferedReader
(
fr
);
//创建FileWriter对象
FileWriter
fw
=
new
FileWriter
(
"D:/www/test_back_buff.txt"
);
bw
=
new
BufferedWriter
(
fw
);
String
s
=
""
;
//循环读取文件
while
(
null
!=(
s
=
br
.
readLine
())){
fw
.
write
(
s
+
"
\r
\n
"
);
}
}
catch
(
Exception
e
) {
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
finally
{
try
{
br
.
close
();
bw
.
close
();
}
catch
(
IOException
e
) {
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL