1: Login Register IO version case (master)
Ask, write it over again.
Cn.itcast.pojo User
Cn.itcast.dao Userdao
Cn.itcast.dao.impl UserDaoImp1 (realize I don't care)
Cn.itcast.game Guessnumber
Cn.itcast.test Usertest
2: Data manipulation flow (flow of manipulating basic type data) (understanding)
(1) Basic types of data can be manipulated
(2) Stream object name
DataInputStream
DataOutputStream
3: Memory operation flow (understanding)
(1) Sometimes we do not need to produce a file, we can use the memory operation flow
(2) Three kinds
A:bytearrayinputstream, Bytearrayoutputstream
B:chararrayreader, Chararraywriter
C:stringreader, StringWriter
4: Print flow (master)
(1) byte print stream, character print stream
(2) Features
A: Operate the destination only and do not manipulate the data source
B: Can manipulate any type of data
C: If Auto-refresh is enabled, the println () method is called to wrap and refresh
D: can manipulate files directly
problem; Which streams can manipulate files directly?
Look at the API, if its construction method can receive both fi1e and string parameters, it is generally possible to manipulate the file directly
(3) Copying text files
BufferedReader BR New BufferedReader (New FileReader ("A.txt"));
PrintWriter pw= New PrintWriter (New Filewriter (B.txt), true);
String 1ine=nu11;
while ((Line=br.readline ())!=null) {
Pw.printin (line);
}
Pw.close ();
Br.close ();
5: Standard input/output stream (understanding)
(1) There are two fields under the System class
in standard input stream
Out standard output stream
(2) Three kinds of keyboard input methods
Axgs receive parameters for the A:main method
B:systerm.in Packaging via BufferedReader
BufferedReader br = new BufferedReader (New InputStreamReader (System. in));
C:scanner
Scanner sc = new Scanner (system.in);
(3) The principle of the output statement and how to use the character stream output data
A: Principle
System.out.println ("HelloWorld");
PrintStream PS = System.out;
Ps.println ("HelloWorld");
B: Wrap the System.out with a character buffer stream
BufferedWriter bw= New Bufferedwirter (New OutputStreamWriter (System.out));
6: Random Access Stream (understanding
(1) Can write data and read data according to the location of thorium
(2) Case
A: Write Data
B: Read Data
C: Get and change the position of the file pointer
7: Merging flows (understanding)
(1) Write the data of multiple input streams into an output stream.
(2) Construction method
A:sequenceinputstream (inputstream s1, InputStream S2)
B:sequenceinputstream (enumeration<? extends inputstream> e)
8: Serialized Stream (understanding)
(1) The object can be written to a text file or transmitted over the network
(2) How is serialization implemented?
To have the serialized object owning the class implement the serialization interface
The interface is a markup interface. No functionality required to implement
(3) Attention issues
After writing the data to a file, modifying the class will create a problem.
How to solve the problem?
In the class file, give a fixed serialized value
Also, this can solve the yellow warning line problem
(4) Face test
Is the time of serialization?
How to implement serialization
What is deserialization?
9:properties (understanding)
(1) is a collection class, Hashtable subclasses
(2) Unique features
A:public Object setproperties (String key,string value)
B:public string GetProperty (String key)
C:public set<string> Stringpropertynames ()
(3) method of combining IO stream
Loading the contents of the text file into the collection in the form of key-value pairs
public void load (reader reader);
pub1ic void 1oad (InputStream instream);
To store the data in a collection in a text file
public void Store (writer writer, String comments);
public void Store (OutputStream out, String comments)
(4) Case:
A: According to the given file to determine if there is a key is "1isi", if there is a value of 100
B: Write a program to achieve control guess the number of small game program can not play more than 5 times
10:nio (Learn)
(1) The JDK4 appeared nio, optimized for previous IO operations, providing efficiency. But most of what we see is the previous IO
(2) The use of JDK7 NiO
Path: Paths
Paths: Returns a path by using a static method
Fi1es: Provides common functionality
Copy a text file
Writes the data in the collection to the text for
Javase (22) login Registered IO version case, data manipulation flow, memory operation flow, print stream, standard input and output stream, random access stream, merge stream, serialization stream, Properties, NIO