First set: Byte stream read Write scheme
FileInputStream: Byte stream read text file
FileOutputStream: Byte stream write to hard disk
Second set: Character Stream read Write scheme
FileReader: Character Stream reads text
FileWriter: Character Stream writes text
BufferedReader: Custom cache size, read text 8,192 Char
BufferedWriter: Writing text
Generally used in combination with FileReader and filewriter
Fourth set: can read binary (img image, etc.)
DataInputStream: Loading the local img into memory
DataOutputStream:: Writes the In-memory binary data to a file on the hard disk.
Serialization and deserialization:
//Serialization of List<dog> list=New arraylist<dog>(); List.add (New Dog ("Peas",15)); List.add (New Dog ("Peas 2",15)); F ObjectOutputStream oos=NewObjectOutputStream (FOS); Oos.writeobject (list); Fos.close (); Oos.close (); System.Out.println ("Serialization succeeds!"); Deserialization fileinputstream fis=new FileInputStream ( "save.bin "); ObjectInputStream ois=new ObjectInputStream (FIS); List<dog> list= (List<dog>for (Dog dog:list) {system..println (Dog.getname ());} Note: 0102public String msg
Four sets of reading and writing programs