API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.io. RandomAccessFile View Source
Author(s)
unascribed
Since
JDK1.0
Version
1.81, 04/10/06
Serial
Hierarchy
 Object
      RandomAccessFile
Implements
 DataOutput
 DataInput
 Closeable
Subclasses
Description
public class RandomAccessFile
  Instances of this class support both reading and writing to a random access file.
See also:   
Constructors
public RandomAccessFile (File file, String mode) throws FileNotFoundException
  Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.
public RandomAccessFile (String name, String mode) throws FileNotFoundException
  Creates a random access file stream to read from, and optionally to write to, a file with the specified name.
Methods
Hide/Show inherited methods
public void close () throws IOException [Specified in Closeable]
  Closes this random access file stream and releases any system resources associated with the stream.
publicfinal FileChannel getChannel ()
  Returns the unique FileChannel object associated with this file.
publicfinal FileDescriptor getFD () throws IOException
  Returns the opaque file descriptor object associated with this stream.
publicnative long getFilePointer () throws IOException
  Returns the current offset in this file.
publicnative long length () throws IOException
  Returns the length of this file.
publicnative int read () throws IOException
  Reads a byte of data from this file.
public int read (byte[] b) throws IOException
  Reads up to b.length bytes of data from this file into an array of bytes.
public int read (byte[] b, int off, int len) throws IOException
  Reads up to len bytes of data from this file into an array of bytes.
publicfinal boolean readBoolean () throws IOException [Specified in DataInput]
  Reads a boolean from this file.
publicfinal byte readByte () throws IOException [Specified in DataInput]
  Reads a signed eight-bit value from this file.
publicfinal char readChar () throws IOException [Specified in DataInput]
  Reads a character from this file.
publicfinal double readDouble () throws IOException [Specified in DataInput]
  Reads a double from this file.
publicfinal float readFloat () throws IOException [Specified in DataInput]
  Reads a float from this file.
publicfinal void readFully (byte[] b) throws IOException [Specified in DataInput]
  Reads b.length bytes from this file into the byte array, starting at the current file pointer.
publicfinal void readFully (byte[] b, int off, int len) throws IOException [Specified in DataInput]
  Reads exactly len bytes from this file into the byte array, starting at the current file pointer.
publicfinal int readInt () throws IOException [Specified in DataInput]
  Reads a signed 32-bit integer from this file.
publicfinal String readLine () throws IOException [Specified in DataInput]
  Reads the next line of text from this file.
publicfinal long readLong () throws IOException [Specified in DataInput]
  Reads a signed 64-bit integer from this file.
publicfinal short readShort () throws IOException [Specified in DataInput]
  Reads a signed 16-bit number from this file.
publicfinal int readUnsignedByte () throws IOException [Specified in DataInput]
  Reads an unsigned eight-bit number from this file.
publicfinal int readUnsignedShort () throws IOException [Specified in DataInput]
  Reads an unsigned 16-bit number from this file.
publicfinal String readUTF () throws IOException [Specified in DataInput]
  Reads in a string from this file.
publicnative void seek (long pos) throws IOException
  Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.
publicnative void setLength (long newLength) throws IOException
  Sets the length of this file.
public int skipBytes (int n) throws IOException [Specified in DataInput]
  Attempts to skip over n bytes of input discarding the skipped bytes.
public void write (byte[] b) throws IOException [Specified in DataOutput]
  Writes b.length bytes from the specified byte array to this file, starting at the current file pointer.
public void write (byte[] b, int off, int len) throws IOException [Specified in DataOutput]
  Writes len bytes from the specified byte array starting at offset off to this file.
publicnative void write (int b) throws IOException [Specified in DataOutput]
  Writes the specified byte to this file.
publicfinal void writeBoolean (boolean v) throws IOException [Specified in DataOutput]
  Writes a boolean to the file as a one-byte value.
publicfinal void writeByte (int v) throws IOException [Specified in DataOutput]
  Writes a byte to the file as a one-byte value.
publicfinal void writeBytes (String s) throws IOException [Specified in DataOutput]
  Writes the string to the file as a sequence of bytes.
publicfinal void writeChar (int v) throws IOException [Specified in DataOutput]
  Writes a char to the file as a two-byte value, high byte first.
publicfinal void writeChars (String s) throws IOException [Specified in DataOutput]
  Writes a string to the file as a sequence of characters.
publicfinal void writeDouble (double v) throws IOException [Specified in DataOutput]
  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.
publicfinal void writeFloat (float v) throws IOException [Specified in DataOutput]
  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.
publicfinal void writeInt (int v) throws IOException [Specified in DataOutput]
  Writes an int to the file as four bytes, high byte first.
publicfinal void writeLong (long v) throws IOException [Specified in DataOutput]
  Writes a long to the file as eight bytes, high byte first.
publicfinal void writeShort (int v) throws IOException [Specified in DataOutput]
  Writes a short to the file as two bytes, high byte first.
publicfinal void writeUTF (String str) throws IOException [Specified in DataOutput]
  Writes a string to the file using modified UTF-8 encoding in a machine-independent manner.
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar