Streaming I/O and files with file I/O errors

Source: Internet
Author: User

Streaming I/O and files with file I/O errors

1. Common Input and Output

1.1 InputStream type: indicates the class for generating input from different data sources. The data source includes a byte array String object file pipeline. It works in a similar way as the actual pipeline. It is input from one end and output from the other end; A sequence composed of other types of streams so that they can be collected and merged into a single stream; 1.1.1 each data source has an InputStream subclass. 1.1.2 FilterInputStream is also an InputStream that provides a base class for the "decorator" class, and the "decorator" class can connect attributes or useful interfaces with the input stream. 1.1.3 subclass of InputStream
Subclass Function Constructor Parameters
ByteArrayInputStream Memory buffer can be used as InputStream  
StringBufferInputStream Convert String to InputStream  
FileInputStream Used to read information from a file  
PipedInputStream Generate PipedOutputStream for writing  
SequenceInputStream Converts two or more InputStream objects to a single InputStream.  
FilterInputStream As the modifier interface, the modifier provides useful functions for other InputStream classes.  
1.2 OutputStream type: Used to output the generated data source to different data sources. These data sources include byte array (non-string) files or subclasses of pipeline 1.2.1 OutputStream
Subclass Function Constructor Parameters
ByteArrayOutputStream Create a buffer in the memory. All data sent to the stream must be placed in this buffer zone.  
FileOutputStream Used to write information to a file  
PipedOutputStream The transfer output stream can be connected to the transfer input stream to create a communication pipeline. Sending end of the lost transmission channel  
1.3 FilterInputStream class: two completely different tasks can be completed
Class Function Constructor Parameters
DataInputStream It is used with DataOutputStream, so you can install and port the method to read basic data types (int, char, long) from the stream)  
BufferedInputStream You can use it to prevent the actual write operation from being performed each read operation.  
LineNumberInputStream Tracks the number of rows in the input stream. You can call getLineNumber () and setLineNumber (int) to read and set the number of rows.  
PushbackInputStream With "one byte push-back buffer", the last character read can be rolled back.  
1.4 FilterOutputStream class
Class Function Constructor Parameters
DataOutputStream Used with DateInputStream, you can write basic data (int, char, long) to the stream in a portable manner)  
PrintStream Used to generate formatted output, where DataOutputStream stores the processed data and PrintStream processes the display  
BufferedOutputStream It can be used to avoid actual write operations every time data is sent, representing "using the buffer zone". You can call flush () to clear the buffer zone.  

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.