Convert byte streams to byte streams, and convert byte streams to characters.
The readLine method is the method in the BufferedReader class of the bytes stream.
The keyboard read method is the byte stream InputStream method.
Can I change byte stream to the bytes stream and use the readLine method of the SWAp stream buffer?
InpuStream in = System. in;
// Convert a byte stream object to a byte stream
InputStreamReader isr = new InputStreamReader (in );
// Use the shard stream buffer to improve efficiency
BufferedReader bufr = new BufferedReader (isr );
String line = null;
While (line = bufr. readLine ())! = Null ){
if(“over”.equals(line))
break;
sysout(line.toUpperCase());
}
Bufr. close ();
What is the conversion between byte stream and byte stream in IO stream? Explanation
Byte streams can be encapsulated into bytes streams.
01. // create a byte stream
02. FileOutputStream fos = new FileOutputStream (new File ("F: \ testSource \ newFile2.txt "));
03. // convert the output stream of the stream packaging (Change byte stream to the bytes Stream)
04. OutputStreamWriter osw = new OutputStreamWriter (fos );
05. // write characters to the stream
06. osw. write ("this ");
07. osw. write ("is ");
08. osw. write ("OutputStreamWriter ");
09. // fl the stream into the file
10. osw. flush ();
11. // close the stream
12. fos. close ();
The primary stream cannot be converted into word-based throttling.
Reference: blog.csdn.net/..707762
In java, how does one switch the sub-byte stream to the bytes stream?
InputStreamReader input =
New InputStreamReader (
New FileInputStream ("byte stream "),
Charset. forName ("UTF-8 "));