Overview of buffered streams
- Buffered streams are input and output streams with buffers
- Buffered streams can significantly reduce our access to IO and protect hard disk!
- The buffer flow itself is the processing flow (wrapped flow), so the buffer flow must be attached to the node flow (original flow)
- The processing flow is the flow wrapped on the original node, which is equivalent to A pipe wrapped on a pipe
Create a character streamRead span>File object:
BufferedReader br = new BufferedReader(< span style="color: #0000ff;">new FileReader("readme.txt"));
Create a character streamWrite file object:
BufferedWriter bw = new BufferedWriter(new FileWriter("dest.txt"));
Use while loop to read and write data:
char[] chs = new char[2048];
int len;
while((len = br.read(chs)) != -1) {
bw.write(chs);
}
bw.flush();//Remember to refresh the buffer stream
Close the resource:
< /span>
Of course, it is also possible to copy files with a buffer stream, which is very efficient!
BufferedReader br = new BufferedReader(new< /span> FileReader("readme.txt"));
BufferedWriter bw = new BufferedWriter(< span style="color: #0000ff;">new FileWriter("dest.txt"));
char[] chs = new char[2048];
int len;
while((len = br.read(chs)) != -1) {
bw.write(chs);
}
bw.flush();//Remember to refresh the buffer stream
br.close();
bw.close();
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1354 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC