I started school on the first day of today and wrote my blog for the first time. I have never written this before. I only read celebrity blogs and so on, I feel that this blog should be something written by a master or other people. I suddenly asked me to write it. I really don't know where to start. However, since the task is coming, escaping is not a programmer's character, even if it's hard, you have to stick it to your head. Maybe it's not good at the beginning. After all, it's hard at the beginning. It may be better if you have passed this stage ....
Today, I mainly learn the input and output of JAVA data streams. The following are my summary points...
Data streams are classified into two categories: InputStream and OutputStream. The input stream can only be read but not write, while the output stream can only be written and not read.
To improve data transmission efficiency, a Buffer Stream is usually used, that is, a Stream is equipped with a Buffer, and a Buffer is a memory dedicated for data transmission.
JAVA implements standard output and input functions through System-like systems. The System class lives a final class in the java. lang package. The System class cannot create objects, but directly uses three of them, namely in out and err.
System. as an InputStream object of the byte input stream, the in class uses the read () method to receive data from the keyboard for standard line of sight input, and throws an IOException when an IO error occurs using the read () method.
System. out is the PrintStream object of the print stream class, which is used to implement standard input. There are two methods: print () and println (). The two methods support parameters of the basic type of java.
System. err implements standard error output using the err Object of the PrintStream class.
The InputStream and OutputStream classes are both abstract classes and cannot be instantiated. Therefore, they are not used in actual applications. Instead, they use other basic data stream classes, both of which are subclasses of InputStream and OutputStream, while implementing its super-tired method, it also defines its unique functions for different application scenarios.
FileInputStream and FileOutputStream are the data objects used by the Ministry of Education for file input and output processing.
FileInputStream is used to access local files in sequence. It inherits read () close () and other methods from the superclass InputStream to operate the files on the machine, but does not support the mark () method and reser () method.
FileOutputStream is used to write data to a file. It inherits the write () close () and other methods from the superclass OutputStream.
Author "my blog"