The classification and application of IO stream in Java

Source: Internet
Author: User
Tags serialization

=======i/o==========================================================================

File: Represents the files or directories on the disk

I/O:JVM data exchange with external data sources. FILE,DB-IN-ÀJVM---out-àfile,db

There are three categories of flows:

Direction: input stream and output stream;

Unit: Byte stream and character stream;

byte stream:

Parent interface for Inputstream/outputstream Byte stream

(1) Fileinputstream/fileoutputstream file byte stream ((can be converted downward))

Datainputstream/dataoutputstream Read and write 8 basic types and read and write strings in UTF-8

Bufferedinputstream/bufferedoutputstream buffered input/output streams

PrintStream fused data and buffered, System.out belongs to the class

Piped pipeline for exchanging data between threads

Randomaccessfile Random Access files

stream of characters: Handling character encoding issues

Reader/writer the parent interface of a character stream

Filereader/filewriter file character stream, and Fileinputstream/fileoutputstream file stream,

(can be converted downward) is equal to (1) above,

Only one is a byte stream, the following is a character stream, so two can not be passed by legend

Inputstreamreader/outputstreamwriter Bridge Conversion converts bytes into character streams in the process of bridge conversion, you can make a codec

Bufferedreader/printwriter with Buffer

When a character stream is converted to a byte stream, the specified codec is specified when the bridge is converted.

Function points: node flow and filter flow;

Node stream: Used to transfer data.

Filter Flow: Helps the node stream to better transmit data.

Piped (Pipeline node Flow): Used to transfer data between two threads. The output of one thread, which is the input of another thread.

Serialization of objects:

Put objects on the stream to transmit Objectinputstream/objectoutputstream

Only objects that implement the serializable interface can be serialized

Properties that are decorated with transient, are temporary properties, do not participate in serialization, and can only be decorated with properties of the object.

The classification and application of IO stream in Java

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.