Java I/O input/output stream details, java details

Source: Internet
Author: User

Java I/O input/output stream details, java details
Introduction

Java IO streams are essential to read and write files in Java. This blog post mainly introduces the content of the input and output streams in Java, including File encoding, File class management of files and directories, and basic operations of byte streams and hidden streams, and Object serialization and deserialization.

An IO stream is an input/output stream used to process data on a device. The device here refers to hard disk, memory, keyboard entry, network transmission, etc.

PressData processing typeByte stream and byte stream.

PressStream directionInput stream and input stream.

PS: when you are a beginner, it is easy for beginners to figure out when to use the input stream and when to use the output stream. To put it simply, when you need to read data, you need to use an input stream. When you need to write data, you need to use an output stream. I used to remember this: "read and write". If you want to read data, you can use the input stream. If you want to write data, you can use the output stream. I often think of these four words, and I am very familiar with them.

When to use byte stream? When should I use the livestream?

First, you need to know that any data stored on the hard disk is stored in binary format. Byte streams allow you to read arbitrary files. A byte stream reads one byte at a time. When a byte stream reads one or more bytes, it searches for the specified encoding table and returns the corresponding encoding. Therefore, the byte stream can only process plain text character data, while the byte stream can process more types of data, such as slice, video, and audio files. Therefore, as long as it is plain text data processing, the use of plain stream is preferred. In other cases, byte streams are used.

What is the significance of Learning Object serialization and deserialization?

In a distributed environment, no matter what type of data, it will be transmitted on the network in the form of binary sequence. Serialization is a process that describes an object in a series of bytes. It is used to solve the problems caused by read/write operations on the object stream. Serialization can write the object state in a stream for network transmission, or store it in a file or database, and read the stream as needed to recreate an identical object.

For example, in Java programming, Object serialization can convert Java objects into files stored in bytes. Such files can be transmitted over the network to various networks, then it is parsed into a Java object through deserialization, which is the basis for network programming.

Contents

Because there are too many Java I/O streams, the Directory of the total content is listed here. Click the corresponding directory to jump to the corresponding blog. The update progress has been completed. Next, I will start to learn Java Network Programming, addFollowUpdate information is received immediately ~

SuggestionsFavoritesIn this blog, you can easily jump to the corresponding content as a directory, making it more convenient and convenient (• ̀ ω • ́) y

  • [Java IO stream] (1) coding problems in computers

  • [Java IO stream] (2) use of the File class

  • [Java IO stream] (3) Use of RandomAccessFile

  • [Java IO stream] (4) byte stream application

  • [Java IO stream] (5) application of the callback stream
  • [Java IO stream] (6) serialization and deserialization of Objects

Related Article

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.