Java IO streams notes

I

IO stream Type:

1, stream input - output stream

2, the byte stream - character stream

 

Operation concept of flow:

 

 

1 , byte stream - read binary files

inputStream / OutputStream // abstract class read - write

FileInputStream / FileOutputStream // implementation class to read and write

BufferedInputStream / BufferedOutputStream // class buffered - encapsulating more than two functional classes

 

2 , Jifuryu

Reader / Writer // abstract class

FileReader / FileWriter // implementation class

BufferedReader / BufferedWriter // extended implementation class

InputStreamReader / InputStreWriter // convert byte characters will appear in the actual application

 

IO create commonly used functions &

 

 

 

Basic operations using

 

 

 

And anti-target sequences of sequences of

Serialization - write

ObjectOutputStream os_1 = new ObjectOutputStream(new FileOutputStream("路径",false)); //创建

os_1.writeObject (Object 1);

os_1.writeObject (Object 2);

os_1.close (); // remember to close the stream

Deserialization - Reading

ObjectInputStream is = new ObjectInputStream (new FileInputStream ( "path")); // Create

1 = Object (Object 1) is.readObject (); // read and converted to an object type 1

2 = Object (Object 2) is.readObject (); // read and converted to the target type 2

is .close (); // remember to close the stream

 

Old nine school community members produced

Guess you like

Origin www.cnblogs.com/ljxt/p/11609084.html