"DAY13" Java 13th day I/O learning Note

Source: Internet
Author: User

Row delimiters can be obtained by means of the method in Java.

The system property name is Line.separator.

The row separators for different platforms are different.

windows7:\r\n

MacOS: \ n

--------------------------------

System.getproperty ("Line.separator"); //Execute system Property name/


FileWriter: No buffer function

---------------------------

itself does not add any functionality to the inherited OutputStreamWriter.

Write () {

Write the data directly to the file.

Sun.nio.cs.StreamEncoder.write (...);

}


BufferedWriter:

----------------------------------

The writer is wrapped, which defines a buffer, which provides writing to a single character, char[], and a string method.

Improve write efficiency.


Hierarchy tree structure: Object-------BufferedWriter

Flushbuffer (): Clears the buffer and writes the buffer data to the destination.

Close () method: Contains Flushbuffer ().

The buffer must be combined with a stream before it can be used.

The function of convection is enhanced on the basis of flow.

FileReader

-----------------

Inheritance tree: Object--InputStreamReader----FileReader

Read () {

Inputstreamreader.read () {

Sun.nio.cs.StreamDecoder.read ();

}

}

BufferedReader

------------------

Inheritance tree: Object--BufferedReader----LineNumberReader

Read () {

char[] Cbuf = ...;

CBUF[XXX] = c;

Fill ();

return C;

}

The flow is introduced to avoid frequent access to physical files.


byte[] bytes = new byte[1023];

byte[] B2 = bytes;

bytes = NULL;


Flush ()//cleanup

Refresh () //refreshing

Clear ()//clear


BYTE stream:

The basic operation is the same as the character stream class.

But it can not only manipulate characters, but also manipulate other media files (JPG.MP3.AVI ... )


OutputStream: Output stream (byte stream)

---------------------------------

is the parent class of Filteroutputstream and FileOutputStream.


InputStream: Input stream (byte stream)

---------------------------------

It's FilterInputStream and FileInputStream's parent class.


Metadata: Metadata that describes the data.

-----------------------------------

In Java, metadata exists in Java code in the form of tags, and the presence of metadata tags does not affect the compilation and execution of program code, but is used to generate other files or needles that know the description of the running code at run time.


"DAY13" Java 13th day I/O learning Note

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.