java programming byte flow into the implementation of the character stream


java programming byte flow into the implementation of the character stream

import java.io.*;
/*readLine The method is the character stream BufferReader Methods in a class
 *  The keyboard input method is a byte stream InputStream The method of
 *  Can you stream the bytes into a character stream and then use the character stream buffer readLine Method?
 *
 * InputStreamReader Class is the bridge of the byte stream to the character stream. (it is itself 1 A stream of characters is therefore accepted at construction time 1 Byte stream)
 *
 * */
public class TransStreamDemo {


public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
// Gets the keyboard entry object
InputStream in=System.in;
// The byte stream   Object into a character stream object   Using transformation flow   Note that the conversion stream itself is a character stream   So the incoming object must be a byte stream object.
InputStreamReader isr=new InputStreamReader(in);
// In order to improve efficiency, perform the string buffer technique of the university operation. use BufferedReader
BufferedReader br=new BufferedReader(isr);
String str=null;
while((str=br.readLine())!=null){
if("over".equals(str))
break;
System.out.println(str.toUpperCase());
}
br.close();
}
}