java.io detailed

Source: Internet
Author: User

A Input and output

1. Stream represents any data source capable of producing data, or any receiving source capable of receiving data. In Java io, all the stream (including input and out stream) includes two types:

1.1 Byte-oriented stream

A byte-oriented stream that represents the reading or writing of information from a stream to a stream in bytes. The byte-oriented stream includes the following types:

1 input stream:

1) Bytearrayinputstream: Use a buffer in memory as a InputStream

2) StringBufferInputStream: Put a String object as a InputStream

3) FileInputStream: A file as a inputstream, to achieve the read operation of the file

4) PipedInputStream: Realize the concept of pipe, mainly used in the thread

5) Sequenceinputstream: Combine multiple inputstream into one InputStream

2) out stream

1) Bytearrayoutputstream: Storing information in a buffer in memory

2) FileOutputStream: Deposit The information in the file

3) PipedOutputStream: Realize the concept of pipe, mainly used in the thread

4) Sequenceoutputstream: Combine multiple outstream into one OutStream

1.2 Stream with Unicode characters as the guide

A Unicode-oriented stream that writes information from a stream to read from or to a stream in a Unicode character. The Unicode character-oriented stream includes the following types:

1 Input Stream

1) CharArrayReader: corresponding to the Bytearrayinputstream

2) StringReader: corresponding to the StringBufferInputStream

3) FileReader: corresponding to the FileInputStream

4) Pipedreader: corresponding to the PipedInputStream

2) Out Stream

1) Chararraywrite: corresponding to the Bytearrayoutputstream

2) Stringwrite: No corresponding byte-oriented stream

3) FileWrite: corresponding to the FileOutputStream

4) Pipedwrite: corresponding to the PipedOutputStream

The character-oriented stream basically has a byte-oriented stream corresponding to it. Two corresponding classes implement the same functionality, the word is in the operation of the different direction. such as CharArrayReader: and Bytearrayinputstream function is to use a buffer in memory as a inputstream, the difference is that the former each time from memory to read a byte of information, the latter each time from memory read a character.

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.