File
The absolute file name consists of the file name, complete path, and drive letter. File (pathname: string) creates a file object exists (): booleancanread (): booleancanwrite (): booleanisdirectory (): booleanisfile (): booleanisabsoulate (): booleanishidden (): trim (): stringgetname (): stringgetpath (): stringgetparent (): stringlastmodified (): longlength (): longlistfile (): file [] Delete (): booleanrenameto (DEST: file): Boolean can use the delimiter class and printwriter class to read and write string and value information from text files. Jav A. Io. printwriter class can be used to create a file and write data to the text file. Printwriter output = new printwriter (filename); you can call the print, println, and printf methods of the printwriter object to write data to the file in Java. util. the values class can be used to read string and basic data type values. Read partition input = new partition (system. in); to read from a file, create a scanner1_input = new partition (new file (filename) for the file; close () to close hasnext () if the scanner still has readable data next (): String put back the next flag as the string nextline (): String read a line nextbyte (): bytenextshort (): bytes nextint (): intnextlong (): longnextfloat (): floatnextdouble (): The doubleinputstream class is the root class of the binary input class, And the outputstream class is the root class of the binary output class. Method: Read (): intread (B: byte []) read B from the input stream. length array read (B: byte [], off: int, Len: INT) read byte, stored in B [off], B [off + 1]... B [off + len-1]. available (): int close (): Close SKIP (N: Long) to skip and discard n Bytes of the input stream mark () mark the current input stream position reset (): the last time void calls this input stream, it resets this stream write (int B): void writes the specified byte write (B: byte []) to the output stream: void writes array B to write (B: byte [], off: int, Len: INT) to B [off], B [off + len-1] Write to output stream flush (): the fileinputstream and fileoutputstream classes refresh the stream to read and write data to the file. Both the inputstream class and the outputstream class inherit the fiterinputstream class and the fiteroutputstream class to filter data streams for a certain purpose. The read provided by the Basic byte input stream only reads bytes. The datainputstream and dataoutputstream classes must be used to process basic numeric types. Readboolean (): Boolean writeboolean (): void readbyte (): byte writebyte (): voidreadchar (): Char writechar (): voidreadfloat (): Float writefloat (): voidreaddouble (): Double writedouble (): voidreadint (): int writeint (): void readlong (): Long writelong (): voidreadshort (): Short writeshort (): voidreadline (): string writeline (): voidreadutf (): String writeutf (): voidbufferedinoutstream class and bufferedoutputst The ream class can increase the speed of input and output by reducing the number of reads and writes. They add a buffer object Input and Output datainputstream and dataoutputstream for the storage bytes to implement the input and output of basic data types and strings. Objectinputstream and objectoutputstream not only contain the functions of datainputstream and dataoutputstream, but also implement the input and output of objects. Readobject (): objectwriteobject (): Not every object in the void can be written to the output stream. Objects in the output stream can be written to the serializable object. Because the serializable object is an instance of the Java. Io. serializable interface. The serializable interface must be implemented for the class of the serializable object. The serializable interface is a mark interface. Because it does not have a method. Therefore, you do not need to add additional code implementation in the class. This interface enables Java serialization to automatically complete the object storage process. Public class Foo implements java. Io. serializable {private int V1; Private Static double V2; private transient A V3 = new A ();} the element marked as transient is not serialized.