java.io.RandomAccessFile (JDK 1.0)
This class allows reading and writing of arbitrary bytes, text, and primitive Java data types from or to any specified location in a file. Because this class provides random, rather than sequential, access to files, it is neither a subclass of InputStream nor of OutputStream, but provides an entirely independent method for reading and writing data from or to files. RandomAccessFile implements the same interfaces as DataInputStream and DataOutputStream, and thus defines the same methods for reading and writing data as those classes do.
The seek() method provides random access to the file--it is used to select the position in the file from which, or to which, data should be read or written. The mode argument to the constructor methods should be "r" for a file that is to be read-only, and "rw" for a file that is to be written (and perhaps read as well).
public classRandomAccessFileextends Object implements DataOutput, DataInput { //Public ConstructorspublicRandomAccessFile(Stringname, Stringmode) throws IOException; publicRandomAccessFile(Filefile, Stringmode) throws IOException; //Public Instance Methodspublic native voidclose() throws IOException; public final FileDescriptorgetFD() throws IOException; public native longgetFilePointer() throws IOException; public native longlength() throws IOException; public native intread() throws IOException; public intread(byte[]b, intoff, intlen) throws IOException; public intread(byte[]b) throws IOException; public final booleanreadBoolean() throws IOException; //From DataInputpublic final bytereadByte() throws IOException; //From DataInputpublic final charreadChar() throws IOException; //From DataInputpublic final doublereadDouble() throws IOException; //From DataInputpublic final floatreadFloat() throws IOException; //From DataInputpublic final voidreadFully(byte[]b) throws IOException; //From DataInputpublic final voidreadFully(byte[]b, intoff, intlen) throws IOException; //From DataInputpublic final intreadInt() throws IOException; //From DataInputpublic final StringreadLine() throws IOException; //From DataInputpublic final longreadLong() throws IOException; //From DataInputpublic final shortreadShort() throws IOException; //From DataInputpublic final StringreadUTF() throws IOException; //From DataInputpublic final intreadUnsignedByte() throws IOException; //From DataInputpublic final intreadUnsignedShort() throws IOException; //From DataInputpublic native voidseek(longpos) throws IOException; public intskipBytes(intn) throws IOException; //From DataInputpublic native voidwrite(intb) throws IOException; //From DataOutputpublic voidwrite(byte[]b) throws IOException; //From DataOutputpublic voidwrite(byte[]b, intoff, intlen) throws IOException; //From DataOutputpublic final voidwriteBoolean(booleanv) throws IOException; //From DataOutputpublic final voidwriteByte(intv) throws IOException; //From DataOutputpublic final voidwriteBytes(Strings) throws IOException; //From DataOutputpublic final voidwriteChar(intv) throws IOException; //From DataOutputpublic final voidwriteChars(Strings) throws IOException; //From DataOutputpublic final voidwriteDouble(doublev) throws IOException; //From DataOutputpublic final voidwriteFloat(floatv) throws IOException; //From DataOutputpublic final voidwriteInt(intv) throws IOException; //From DataOutputpublic final voidwriteLong(longv) throws IOException; //From DataOutputpublic final voidwriteShort(intv) throws IOException; //From DataOutputpublic final voidwriteUTF(Stringstr) throws IOException; //From DataOutput}