RandomAccessFile方法很多看help吧
writeUTF
writeShort
writeLong
writeInt
writeFloat
writeChar
writeChars
writeDouble
writeBytes
write
seek
read 

解决方案 »

  1.   

     void close() 
              Closes this random access file stream and releases any system resources associated with the stream. 
     FileDescriptor getFD() 
              Returns the opaque file descriptor object associated with this stream. 
     long getFilePointer() 
              Returns the current offset in this file. 
     long length() 
              Returns the length of this file. 
     int read() 
              Reads a byte of data from this file. 
     int read(byte[] b) 
              Reads up to b.length bytes of data from this file into an array of bytes. 
     int read(byte[] b, int off, int len) 
              Reads up to len bytes of data from this file into an array of bytes. 
     boolean readBoolean() 
              Reads a boolean from this file. 
     byte readByte() 
              Reads a signed eight-bit value from this file. 
     char readChar() 
              Reads a Unicode character from this file. 
     double readDouble() 
              Reads a double from this file. 
     float readFloat() 
              Reads a float from this file. 
     void readFully(byte[] b) 
              Reads b.length bytes from this file into the byte array, starting at the current file pointer. 
     void readFully(byte[] b, int off, int len) 
              Reads exactly len bytes from this file into the byte array, starting at the current file pointer. 
     int readInt() 
              Reads a signed 32-bit integer from this file. 
     String readLine() 
              Reads the next line of text from this file. 
     long readLong() 
              Reads a signed 64-bit integer from this file. 
     short readShort() 
              Reads a signed 16-bit number from this file. 
     int readUnsignedByte() 
              Reads an unsigned eight-bit number from this file. 
     int readUnsignedShort() 
              Reads an unsigned 16-bit number from this file. 
     String readUTF() 
              Reads in a string from this file. 
     void seek(long pos) 
              Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. 
     void setLength(long newLength) 
              Sets the length of this file. 
     int skipBytes(int n) 
              Attempts to skip over n bytes of input discarding the skipped bytes. 
     void write(byte[] b) 
              Writes b.length bytes from the specified byte array to this file, starting at the current file pointer. 
     void write(byte[] b, int off, int len) 
              Writes len bytes from the specified byte array starting at offset off to this file. 
     void write(int b) 
              Writes the specified byte to this file. 
     void writeBoolean(boolean v) 
              Writes a boolean to the file as a one-byte value. 
     void writeByte(int v) 
              Writes a byte to the file as a one-byte value. 
     void writeBytes(String s) 
              Writes the string to the file as a sequence of bytes. 
     void writeChar(int v) 
              Writes a char to the file as a two-byte value, high byte first. 
     void writeChars(String s) 
              Writes a string to the file as a sequence of characters. 
     void writeDouble(double v) 
              Converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the file as an eight-byte quantity, high byte first. 
     void writeFloat(float v) 
              Converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the file as a four-byte quantity, high byte first. 
     void writeInt(int v) 
              Writes an int to the file as four bytes, high byte first. 
     void writeLong(long v) 
              Writes a long to the file as eight bytes, high byte first. 
     void writeShort(int v) 
              Writes a short to the file as two bytes, high byte first. 
     void writeUTF(String str) 
              Writes a string to the file using UTF-8 encoding in a machine-independent manner