Java java.io RandomAccessFile fields, constructors, methods, implement or subclass

Example usage for Java java.io RandomAccessFile fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.io RandomAccessFile.

The text is from its open source code.

Constructor

RandomAccessFile(String name, String mode)
Creates a random access file stream to read from, and optionally to write to, a file with the specified name.
RandomAccessFile(File file, String mode)
Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.

Method

voidclose()
Closes this random access file stream and releases any system resources associated with the stream.
FileChannelgetChannel()
Returns the unique java.nio.channels.FileChannel FileChannel object associated with this file.
FileDescriptorgetFD()
Returns the opaque file descriptor object associated with this stream.
longgetFilePointer()
Returns the current offset in this file.
longlength()
Returns the length of this file.
intread()
Reads a byte of data from this file.
intread(byte b[], int off, int len)
Reads up to len bytes of data from this file into an array of bytes.
intread(byte b[])
Reads up to b.length bytes of data from this file into an array of bytes.
booleanreadBoolean()
Reads a boolean from this file.
bytereadByte()
Reads a signed eight-bit value from this file.
charreadChar()
Reads a character from this file.
doublereadDouble()
Reads a double from this file.
floatreadFloat()
Reads a float from this file.
voidreadFully(byte b[])
Reads b.length bytes from this file into the byte array, starting at the current file pointer.
voidreadFully(byte b[], int off, int len)
Reads exactly len bytes from this file into the byte array, starting at the current file pointer.
intreadInt()
Reads a signed 32-bit integer from this file.
StringreadLine()
Reads the next line of text from this file.
longreadLong()
Reads a signed 64-bit integer from this file.
shortreadShort()
Reads a signed 16-bit number from this file.
intreadUnsignedByte()
Reads an unsigned eight-bit number from this file.
intreadUnsignedShort()
Reads an unsigned 16-bit number from this file.
StringreadUTF()
Reads in a string from this file.
voidseek(long pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.
voidsetLength(long newLength)
Sets the length of this file.
intskipBytes(int n)
Attempts to skip over n bytes of input discarding the skipped bytes.
StringtoString()
Returns a string representation of the object.
voidwrite(int b)
Writes the specified byte to this file.
voidwrite(byte b[])
Writes b.length bytes from the specified byte array to this file, starting at the current file pointer.
voidwrite(byte b[], int off, int len)
Writes len bytes from the specified byte array starting at offset off to this file.
voidwriteBoolean(boolean v)
Writes a boolean to the file as a one-byte value.
voidwriteByte(int v)
Writes a byte to the file as a one-byte value.
voidwriteBytes(String s)
Writes the string to the file as a sequence of bytes.
voidwriteChar(int v)
Writes a char to the file as a two-byte value, high byte first.
voidwriteChars(String s)
Writes a string to the file as a sequence of characters.
voidwriteDouble(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.
voidwriteFloat(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.
voidwriteInt(int v)
Writes an int to the file as four bytes, high byte first.
voidwriteLong(long v)
Writes a long to the file as eight bytes, high byte first.
voidwriteShort(int v)
Writes a short to the file as two bytes, high byte first.
voidwriteUTF(String str)
Writes a string to the file using modified UTF-8 encoding in a machine-independent manner.