The RandomaccessFile class has the function of file operation. (Important) Constructor RandomaccessFile (File File, String Mode) RandomaccessFile) String name, string mode) Parameter Description File: Specified file object mode: Specified mode of operation (R is read mode, RW is read and write mode) Name: Specify The main method of the file name RandomaccessFile class
FileDescriptor getFd () // Gets a description of the file long getfilepointer () // Gets the location of the file pointer long length () // Get file length int tent () // Read a byte Int Read (Byte " ] b) // Read the data of the B.Length by the B.Length by the file and save it to the array B Int Read (Byte [] B, int off, int LEN) // read the LEN byte from the file. The data is saved to the specified location of the array b. Boolean ReadBoolean () // reads a boolean value from the file byte readByte () // reads a byte from the file Char readchar () // Read a character Double ReadDouble () // Reads a Double value from the file Float ReadFloat () // reads a float value void readfully (byte [] b) // from the file to the current pointer position from the file B.Length The data of the byte is in the array B Void ReadFully (Byte [] B, INT OFF, INT LNE) // From the current pointer position in the file, the number of data to // array B is specified positions. INT readint () // Reads an int value from the file String readline () // Read a string long readlong () // from the file () // read a long value short readshort () // from the file SHORT READSHORT () // Read a short value intreadunSignedByte () // reads a unsigned eight-bit value from the file INTUnsignedShort () // reads a non-symbolic hex value String Readutf () // Read a string void seek (long POS) // specifies file pointer in the file pointer in the file Void setLength // Settings the length INT SKIPBYTES (INT N) // Skip in the file The number of bytes void write (byte [] b) // writes a byte array void write (BYTE [] B, INT OFF, INT LEN) 位置 位置 位置 位置 位置 位置Start byte data VOID WRITE for LEN (i NT B) / / Write an INT VOID WRITEBOOLEAN (Boolean V) / / in the file to write a Boolean Void WritebyTe (INT V) to the file to a Byte Void WritebyTe (String S) ) // Write a string void write in a file to a character Void WriteChars (String S) to the file to write a string Void WriteDouble (Double) as a character data. v) // Write a Double Void WriteFloat (FLOAT V) to the file to write a float value void writeint (int V) to the file into the file to a file Void WriteLong (long V) / / Write a UTF string in a short int value Void Writeutf (String Str) // in the file to the file.