public class RandomAccessFileImpl extends java.lang.Object implements IRandomAccessFile
IRandomAccessFile
.Constructor and Description |
---|
RandomAccessFileImpl(java.io.File file,
java.lang.String mode) |
RandomAccessFileImpl(java.io.RandomAccessFile randomAccessFile) |
RandomAccessFileImpl(java.lang.String name,
java.lang.String mode) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
boolean |
equals(java.lang.Object obj) |
void |
flush() |
java.nio.ByteOrder |
getByteOrder()
Gets the byte-order (endiness) of the random access file.
|
java.nio.channels.FileChannel |
getChannel() |
java.io.FileDescriptor |
getFD() |
long |
getFilePointer()
Returns the current offset in this file.
|
int |
hashCode() |
long |
length()
Returns the length of this file.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
java.lang.String |
readLine() |
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
java.lang.String |
readUTF() |
void |
reset() |
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 |
setByteOrder(java.nio.ByteOrder byteOrder)
Sets the byte-order (endiness) of the random access file.
|
void |
setLength(long newLength)
Sets the length of this file.
|
long |
skip(long n) |
int |
skipBytes(int n) |
void |
synchronize()
Performs a synchronization of the resource.
|
java.lang.String |
toString() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(java.lang.String s) |
void |
writeChar(int v) |
void |
writeChars(java.lang.String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(java.lang.String str) |
public RandomAccessFileImpl(java.io.RandomAccessFile randomAccessFile)
public RandomAccessFileImpl(java.lang.String name, java.lang.String mode) throws IOExceptionUnchecked
IOExceptionUnchecked
public RandomAccessFileImpl(java.io.File file, java.lang.String mode) throws IOExceptionUnchecked
IOExceptionUnchecked
public final java.io.FileDescriptor getFD() throws java.io.IOException
java.io.IOException
public final java.nio.channels.FileChannel getChannel()
public java.nio.ByteOrder getByteOrder()
IRandomAccessFile
getByteOrder
in interface IRandomAccessFile
public void setByteOrder(java.nio.ByteOrder byteOrder)
IRandomAccessFile
setByteOrder
in interface IRandomAccessFile
public int read() throws IOExceptionUnchecked
read
in interface IInputStream
IOExceptionUnchecked
InputStream.read()
public int read(byte[] b, int off, int len) throws IOExceptionUnchecked
read
in interface IInputStream
IOExceptionUnchecked
InputStream.read(byte[], int, int)
public int read(byte[] b) throws IOExceptionUnchecked
read
in interface IInputStream
IOExceptionUnchecked
InputStream.read(byte[])
public final void readFully(byte[] b) throws IOExceptionUnchecked
readFully
in interface IRandomAccessFile
readFully
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readFully(byte[])
public final void readFully(byte[] b, int off, int len) throws IOExceptionUnchecked
readFully
in interface IRandomAccessFile
readFully
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readFully(byte[], int, int)
public int skipBytes(int n) throws IOExceptionUnchecked
skipBytes
in interface IRandomAccessFile
skipBytes
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.skipBytes(int)
public void write(int b) throws IOExceptionUnchecked
write
in interface IOutputStream
write
in interface IRandomAccessFile
write
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.write(int)
public void write(byte[] b) throws IOExceptionUnchecked
write
in interface IOutputStream
write
in interface IRandomAccessFile
write
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.write(byte[])
public void write(byte[] b, int off, int len) throws IOExceptionUnchecked
write
in interface IOutputStream
write
in interface IRandomAccessFile
write
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.write(byte[], int, int)
public long getFilePointer() throws IOExceptionUnchecked
IRandomAccessFile
getFilePointer
in interface IRandomAccessFile
IOExceptionUnchecked
- if an I/O error occurs.public void seek(long pos) throws IOExceptionUnchecked
IRandomAccessFile
seek
in interface IRandomAccessFile
pos
- the offset position, measured in bytes from the beginning of the file, at which to
set the file pointer.IOExceptionUnchecked
- if pos
is less than 0
or if an I/O
error occurs.public long length() throws IOExceptionUnchecked
IRandomAccessFile
length
in interface IRandomAccessFile
IOExceptionUnchecked
- if an I/O error occurs.public void setLength(long newLength) throws IOExceptionUnchecked
IRandomAccessFile
If the present length of the file as returned by the length
method is greater
than the newLength
argument then the file will be truncated. In this case, if
the file offset as returned by the getFilePointer
method is greater than
newLength
then after this method returns the offset will be equal to
newLength
.
If the present length of the file as returned by the length
method is smaller
than the newLength
argument then the file will be extended. In this case, the
contents of the extended portion of the file are not defined.
setLength
in interface IRandomAccessFile
newLength
- The desired length of the fileIOExceptionUnchecked
- If an I/O error occurspublic void close() throws IOExceptionUnchecked
close
in interface IInputStream
close
in interface IOutputStream
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
IOExceptionUnchecked
InputStream.close()
public final boolean readBoolean() throws IOExceptionUnchecked
readBoolean
in interface IRandomAccessFile
readBoolean
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readBoolean()
public final byte readByte() throws IOExceptionUnchecked
readByte
in interface IRandomAccessFile
readByte
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readByte()
public final int readUnsignedByte() throws IOExceptionUnchecked
readUnsignedByte
in interface IRandomAccessFile
readUnsignedByte
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readUnsignedByte()
public final short readShort() throws IOExceptionUnchecked
readShort
in interface IRandomAccessFile
readShort
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readShort()
public final int readUnsignedShort() throws IOExceptionUnchecked
readUnsignedShort
in interface IRandomAccessFile
readUnsignedShort
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readUnsignedShort()
public final char readChar() throws IOExceptionUnchecked
readChar
in interface IRandomAccessFile
readChar
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readChar()
public final int readInt() throws IOExceptionUnchecked
readInt
in interface IRandomAccessFile
readInt
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readInt()
public final long readLong() throws IOExceptionUnchecked
readLong
in interface IRandomAccessFile
readLong
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readLong()
public final float readFloat() throws IOExceptionUnchecked
readFloat
in interface IRandomAccessFile
readFloat
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readFloat()
public final double readDouble() throws IOExceptionUnchecked
readDouble
in interface IRandomAccessFile
readDouble
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readDouble()
public final java.lang.String readLine() throws IOExceptionUnchecked
readLine
in interface IRandomAccessFile
readLine
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readLine()
public final java.lang.String readUTF() throws IOExceptionUnchecked
readUTF
in interface IRandomAccessFile
readUTF
in interface java.io.DataInput
IOExceptionUnchecked
DataInput.readUTF()
public final void writeBoolean(boolean v) throws IOExceptionUnchecked
writeBoolean
in interface IRandomAccessFile
writeBoolean
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeBoolean(boolean)
public final void writeByte(int v) throws IOExceptionUnchecked
writeByte
in interface IRandomAccessFile
writeByte
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeByte(int)
public final void writeShort(int v) throws IOExceptionUnchecked
writeShort
in interface IRandomAccessFile
writeShort
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeShort(int)
public final void writeChar(int v) throws IOExceptionUnchecked
writeChar
in interface IRandomAccessFile
writeChar
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeChar(int)
public final void writeInt(int v) throws IOExceptionUnchecked
writeInt
in interface IRandomAccessFile
writeInt
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeInt(int)
public final void writeLong(long v) throws IOExceptionUnchecked
writeLong
in interface IRandomAccessFile
writeLong
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeLong(long)
public final void writeFloat(float v) throws IOExceptionUnchecked
writeFloat
in interface IRandomAccessFile
writeFloat
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeFloat(float)
public final void writeDouble(double v) throws IOExceptionUnchecked
writeDouble
in interface IRandomAccessFile
writeDouble
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeDouble(double)
public final void writeBytes(java.lang.String s) throws IOExceptionUnchecked
writeBytes
in interface IRandomAccessFile
writeBytes
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeBytes(String)
public final void writeChars(java.lang.String s) throws IOExceptionUnchecked
writeChars
in interface IRandomAccessFile
writeChars
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeChars(String)
public final void writeUTF(java.lang.String str) throws IOExceptionUnchecked
writeUTF
in interface IRandomAccessFile
writeUTF
in interface java.io.DataOutput
IOExceptionUnchecked
DataOutput.writeUTF(String)
public long skip(long n) throws IOExceptionUnchecked
skip
in interface IInputStream
IOExceptionUnchecked
InputStream.skip(long)
public int available() throws IOExceptionUnchecked
available
in interface IInputStream
IOExceptionUnchecked
InputStream.available()
public void mark(int readlimit)
mark
in interface IInputStream
InputStream.mark(int)
public void reset() throws IOExceptionUnchecked
reset
in interface IInputStream
IOExceptionUnchecked
InputStream.reset()
public boolean markSupported()
markSupported
in interface IInputStream
InputStream.markSupported()
public void flush() throws IOExceptionUnchecked
flush
in interface IOutputStream
IOExceptionUnchecked
OutputStream.flush()
public void synchronize() throws IOExceptionUnchecked
ISynchronizable
synchronize
in interface IOutputStream
synchronize
in interface ISynchronizable
IOExceptionUnchecked
OutputStream.flush()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object