Java IO (1)

Source: Internet
Author: User

4 blocks to learn Java I/O.

Character-based: Inputstream,outputstream

BYTE-based: Writer,reader

Disk-based: File

Network-based: Socket

The first two are data formats for transmitting data, and the next two are the ways to transfer the data.

Have idea's classmate, follow me to do together, do not have a classmate, download installs well after follow me to do together. Don't want to do it together, imagine doing it with me.

1, CTRL + N, find InputStream this class, class name right-click Diagrams->show Diagram ...

2. Delete other classes, check inputstream,ctrl+alt+b, search for classes, add to diagram, repeat until all classes are loaded into.

3, the Virgo classmate please press F5, to alleviate the discomfort feeling. Please help yourself to a non-Virgo, but I also suggest you F5.

Then, each class is selected and pressed F4 to look at the comments ... Then ask the English good schoolmate to point out my translation the mistake place.

Objectinputstream:1, the goods deserialize those who were previously written by their good friends objectoutputstream primitive data or objects. Please use pairing. 2, this goods in addition to restore the base friends to do things, you can also use the socket between the host object, but also in the remote communication marshal and Unmarshal parameters and parameters. (own Baidu parameter and argument difference) 3, you want to serialize, you want the JVM to have the related class. 4, ReadObject read out their own strong turn into the required format, strting and arrays here is a serious object, as for those low-level primitive, will error. Primitive can be taken out using the appropriate method of Datainput. 6, transient and static will be ruthlessly ignored. Other classes referenced will also be read, deserialize always new application to put object. It is pure and will not pollute. No-arg constructors is invoked for the Non-serializable classes this sentence did not understand.

FileInputStream: Document Good understanding does not explain.

Bufferedinputstream: Can specify the size of a buffer, improve the transmission rate, the principle reminiscent of nio, in fact, some tests on the web also said that the performance is not very different from NIO, in two can achieve the purpose of the scene under the situation with the goods will be more simple.

DataInputStream: In fact, is the grammar of sugar, the bottom is transmitted by byte, the advantage of this goods can not remember the various primitive types accounted for a few pits, how to enter how out on the line.

PipedInputStream: Cross-Threading things, producer-consumer models.

In the same vein:

Internal through Stringencoder and charset conversion, turn out garbled words themselves to adjust the code.




Java IO (1)

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.