Thoroughly understand the Java IO System (Digest) --- Java Enti-Yuxi IO Flow ZHBK [Original]

xiaoxiao2021-03-06  73

One. INPUT and OUTPUT1. Stream represents any data source that has the ability to output data, or any capacity to receive data receiving source. In Java's IO, all streams include two types: 1.1 Byte-oriented stream in byte-oriented Stream, indicating bytes, read or read from Stream in bytes or Write information into the stream. Byte oriented stream comprises the following types: 1) input stream: 1) ByteArrayInputStream: the use of a buffer memory 2) StringBufferInputStream as InputStream: a String object to a InputStream3) FileInputStream: to a file as InputStream Realize the reading operation of the file 4) PipedinputStream: implements the concept of PIPE, mainly in the thread 5) SEQUENCEINPUTSTREAM: Multiple InputStream is merged into an inputStream2) BYTEARRAYOTPUTSTREAM: put information into a buffer in memory District 2) FileOutputStream: PipedputStream: PipedputStream: Implement the concept of PIPE, mainly in the thread 4) SEQUENCEOTPUTSTREAM: Multiple OutStream merge into an outstream1.2 in Unicode Character-oriented Stream in Unicode Character-oriented Stream indicates that the information is read from the stream in units in Unicode characters to the stream. In Unicode character oriented stream comprises the following types: 1) Input Stream1) CharArrayReader: corresponds with ByteArrayInputStream 2) StringReader: corresponds with StringBufferInputStream 3) FileReader: corresponds with FileInputStream 4) PipedReader: corresponds with PipedInputStream 2) Out Stream1) CharArrayWrite : Corresponding to byterrayoutputstream 2) StringWrite: Corresponding to byte-oriented Stream3) FileWrite: with FileoutPutStream Corresponds 4) PiPedWrite: The word corresponding to the PiPedoutputStream corresponds to the word. Section-oriented stream. The two corresponding classes implementation are the same, the word is different during operation. For example, CharaRrayReader: and ByTearRayinputStream uses a buffer in memory as an inputStream, which is different that the former reads a byte information from memory, while the latter reads a character from memory. 1.3 Conversion between two unsampicated streams InputStreamReader and OutputStreamReader: Convert a byte-oriented Stream into a character-oriented Stream. 2. Stream Add Properties 2.1 "Add Property for Stream Add Properties" to operate the IO's API in the Java described above, we can complete any operation we want to complete. But through the subclasses of FilterInputStream and FilterOutstream, we can add properties to Stream. The following examples illustrate the function of this function.

转载请注明原文地址:https://www.9cbs.com/read-120174.html

New Post(0)