RandomAccessFile (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[close](../../java/io/RandomAccessFile.html#close--)()
Closes this random access file stream and releases any system resources associated with the stream.
[FileChannel](../../java/nio/channels/FileChannel.html "class in java.nio.channels")
[getChannel](../../java/io/RandomAccessFile.html#getChannel--)()
Returns the unique FileChannel object associated with this file.
[FileDescriptor](../../java/io/FileDescriptor.html "class in java.io")
[getFD](../../java/io/RandomAccessFile.html#getFD--)()
Returns the opaque file descriptor object associated with this stream.
long
[getFilePointer](../../java/io/RandomAccessFile.html#getFilePointer--)()
Returns the current offset in this file.
long
[length](../../java/io/RandomAccessFile.html#length--)()
Returns the length of this file.
int
[read](../../java/io/RandomAccessFile.html#read--)()
Reads a byte of data from this file.
int
[read](../../java/io/RandomAccessFile.html#read-byte:A-)(byte[] b)
Reads up to b.length
bytes of data from this file into an array of bytes.
int
[read](../../java/io/RandomAccessFile.html#read-byte:A-int-int-)(byte[] b, int off, int len)
Reads up to len
bytes of data from this file into an array of bytes.
boolean
[readBoolean](../../java/io/RandomAccessFile.html#readBoolean--)()
Reads a boolean
from this file.
byte
[readByte](../../java/io/RandomAccessFile.html#readByte--)()
Reads a signed eight-bit value from this file.
char
[readChar](../../java/io/RandomAccessFile.html#readChar--)()
Reads a character from this file.
double
[readDouble](../../java/io/RandomAccessFile.html#readDouble--)()
Reads a double
from this file.
float
[readFloat](../../java/io/RandomAccessFile.html#readFloat--)()
Reads a float
from this file.
void
[readFully](../../java/io/RandomAccessFile.html#readFully-byte:A-)(byte[] b)
Reads b.length
bytes from this file into the byte array, starting at the current file pointer.
void
[readFully](../../java/io/RandomAccessFile.html#readFully-byte:A-int-int-)(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](../../java/io/RandomAccessFile.html#readInt--)()
Reads a signed 32-bit integer from this file.
[String](../../java/lang/String.html "class in java.lang")
[readLine](../../java/io/RandomAccessFile.html#readLine--)()
Reads the next line of text from this file.
long
[readLong](../../java/io/RandomAccessFile.html#readLong--)()
Reads a signed 64-bit integer from this file.
short
[readShort](../../java/io/RandomAccessFile.html#readShort--)()
Reads a signed 16-bit number from this file.
int
[readUnsignedByte](../../java/io/RandomAccessFile.html#readUnsignedByte--)()
Reads an unsigned eight-bit number from this file.
int
[readUnsignedShort](../../java/io/RandomAccessFile.html#readUnsignedShort--)()
Reads an unsigned 16-bit number from this file.
[String](../../java/lang/String.html "class in java.lang")
[readUTF](../../java/io/RandomAccessFile.html#readUTF--)()
Reads in a string from this file.
void
[seek](../../java/io/RandomAccessFile.html#seek-long-)(long pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.
void
[setLength](../../java/io/RandomAccessFile.html#setLength-long-)(long newLength)
Sets the length of this file.
int
[skipBytes](../../java/io/RandomAccessFile.html#skipBytes-int-)(int n)
Attempts to skip over n
bytes of input discarding the skipped bytes.
void
[write](../../java/io/RandomAccessFile.html#write-byte:A-)(byte[] b)
Writes b.length
bytes from the specified byte array to this file, starting at the current file pointer.
void
[write](../../java/io/RandomAccessFile.html#write-byte:A-int-int-)(byte[] b, int off, int len)
Writes len
bytes from the specified byte array starting at offset off
to this file.
void
[write](../../java/io/RandomAccessFile.html#write-int-)(int b)
Writes the specified byte to this file.
void
[writeBoolean](../../java/io/RandomAccessFile.html#writeBoolean-boolean-)(boolean v)
Writes a boolean
to the file as a one-byte value.
void
[writeByte](../../java/io/RandomAccessFile.html#writeByte-int-)(int v)
Writes a byte
to the file as a one-byte value.
void
[writeBytes](../../java/io/RandomAccessFile.html#writeBytes-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") s)
Writes the string to the file as a sequence of bytes.
void
[writeChar](../../java/io/RandomAccessFile.html#writeChar-int-)(int v)
Writes a char
to the file as a two-byte value, high byte first.
void
[writeChars](../../java/io/RandomAccessFile.html#writeChars-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") s)
Writes a string to the file as a sequence of characters.
void
[writeDouble](../../java/io/RandomAccessFile.html#writeDouble-double-)(double v)
Converts the double argument to a long
using thedoubleToLongBits
method in class Double
, and then writes that long
value to the file as an eight-byte quantity, high byte first.
void
[writeFloat](../../java/io/RandomAccessFile.html#writeFloat-float-)(float v)
Converts the float argument to an int
using thefloatToIntBits
method in class Float
, and then writes that int
value to the file as a four-byte quantity, high byte first.
void
[writeInt](../../java/io/RandomAccessFile.html#writeInt-int-)(int v)
Writes an int
to the file as four bytes, high byte first.
void
[writeLong](../../java/io/RandomAccessFile.html#writeLong-long-)(long v)
Writes a long
to the file as eight bytes, high byte first.
void
[writeShort](../../java/io/RandomAccessFile.html#writeShort-int-)(int v)
Writes a short
to the file as two bytes, high byte first.
void
[writeUTF](../../java/io/RandomAccessFile.html#writeUTF-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") str)
Writes a string to the file usingmodified UTF-8 encoding in a machine-independent manner.