Finish the 13th day of it 18 Palm Java Foundation Course today:
Learning content:
HashMap
HashSet
EntrySet ()
|--getkey ()
|--getvalue ()
KeySet ()
|--get (Key)
----------
Performance evaluation with or without buffer
The principle of the buffer is to write the characters into an array and then write the files in bulk, avoiding frequent access to the physical files and increasing efficiency.
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 ().
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;
}
Avoid frequent access to physical files.
byte[] bytes = new byte[1023][1024][1024];
byte[] B2 = bytes;
.
.
.
.
bytes = NULL;
Flush ()//cleanup
Refresh ()//refreshing
Clear ()//clear
OutputStream: Output stream
------------------------
Metadata: Metadata that describes the data.
-----------------------------------
Problems encountered:
The wide range of IO streams requires familiarity with
Questions that need help
This article from "Rookie Achievement Data Road" blog, reproduced please contact the author!
It 18 Palm Palm 13th day Course Summary