Java Input/output

Source: Internet
Author: User

Java Input/output
Java I/O is supported by classes and interfaces under the Java.io package, the most important of which is the 5 classes, File,outputstream,inputstream, Write,reader, and an interface serializable.
File class: The ability to manipulate files
BYTE stream: (Outputstream/inputstream), you can use the byte stream to read the file contents
Character stream: (Writer/reader)
Convert stream: (Inputstreamreader/outputstreamwriter) converts a byte stream to a character stream
Buffered stream: (BufferedReader), reads the contents of the buffer
Memory Operation Flow: (Bytearrayinputstream/bytearrayoutputstream), which can interact with the memory data rows
Print Flow:
Scanner class: Input to input, can also validate data
Merge flow: (Sequenceinputstream) class can combine two file contents into one file
Compress stream: Compress operations on files
Serializable interface: Serialization of objects
Input byte stream level:
InputStream (parent Class): Bytearrayinputstream,fileinputstream,stringbufferinputstream,sequenceinputstream, Objectinputstream,filterinputstream (Bufferedinputstream,datainputstream,linenumberinputstream, Pushbackinputstream) [Sub-class]

Output byte stream level:
OutputStream (parent Class): Bytearrayoutputstream,fileoutputstream,objectoutputstream,pipedoutputstream, Filteroutputstream (Bufferedoutputstream,dataoutputstream,pintstream) [Sub-class]

Enter the hierarchy of the character stream class:
Reader (parent Class): BufferedReader (LineNumberReader), Chararrayreader,filterreader (Pushbackreader), InputStreamReader ( FileReader), Pipedreader,stringreader

The level of the output character stream class:
Writer (parent Class): Bufferedwriter,chararraywriter,filterwrite,outputstreamwrite (FileWriter), Pipedwriter,printwriter, StringWriter
In addition to the "flow" in the java.io package, there is also a built-in flow in the Java.lang package, the System class, which contains 3 predefined stream variables, in,out and err, which are public and static, This means that you can call directly without the object of the System class. System.out is the standard output stream, which is output to the monitor by default. System.in is the standard input stream, which, by default, is the input keyboard data. System.err is the standard error stream, and the default is to output to the monitor.

Java Input/output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.