Package ch.systemsx.cisd.base.io
Interface IRandomAccessFile
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.io.DataInput
,java.io.DataOutput
,IInputStream
,IOutputStream
,ISynchronizable
- All Known Implementing Classes:
ByteBufferRandomAccessFile
,RandomAccessFileImpl
public interface IRandomAccessFile extends java.io.DataInput, java.io.DataOutput, java.io.Closeable, IInputStream, IOutputStream
The interface ofRandomAccessFile
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.nio.ByteOrder
getByteOrder()
Gets the byte-order (endiness) of the random access file.long
getFilePointer()
Returns the current offset in this file.long
length()
Returns the length of this file.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
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.int
skipBytes(int n)
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)
-
Methods inherited from interface ch.systemsx.cisd.base.io.IInputStream
available, close, mark, markSupported, read, read, read, reset, skip
-
Methods inherited from interface ch.systemsx.cisd.base.io.IOutputStream
close, flush, synchronize
-
-
-
-
Method Detail
-
getByteOrder
java.nio.ByteOrder getByteOrder()
Gets the byte-order (endiness) of the random access file. Default is network-byte order (big-endian).
-
setByteOrder
void setByteOrder(java.nio.ByteOrder byteOrder)
Sets the byte-order (endiness) of the random access file.
-
getFilePointer
long getFilePointer() throws IOExceptionUnchecked
Returns the current offset in this file.- Returns:
- the offset from the beginning of the file, in bytes, at which the next read or write occurs.
- Throws:
IOExceptionUnchecked
- if an I/O error occurs.
-
seek
void seek(long pos) throws IOExceptionUnchecked
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs. The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.- Parameters:
pos
- the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.- Throws:
IOExceptionUnchecked
- ifpos
is less than0
or if an I/O error occurs.
-
length
long length() throws IOExceptionUnchecked
Returns the length of this file.- Returns:
- the length of this file, measured in bytes.
- Throws:
IOExceptionUnchecked
- if an I/O error occurs.
-
setLength
void setLength(long newLength) throws IOExceptionUnchecked
Sets the length of this file.If the present length of the file as returned by the
length
method is greater than thenewLength
argument then the file will be truncated. In this case, if the file offset as returned by thegetFilePointer
method is greater thannewLength
then after this method returns the offset will be equal tonewLength
.If the present length of the file as returned by the
length
method is smaller than thenewLength
argument then the file will be extended. In this case, the contents of the extended portion of the file are not defined.- Parameters:
newLength
- The desired length of the file- Throws:
IOExceptionUnchecked
- If an I/O error occurs
-
readFully
void readFully(byte[] b) throws IOExceptionUnchecked
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readFully(byte[])
-
readFully
void readFully(byte[] b, int off, int len) throws IOExceptionUnchecked
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readFully(byte[], int, int)
-
skipBytes
int skipBytes(int n) throws IOExceptionUnchecked
- Specified by:
skipBytes
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.skipBytes(int)
-
readBoolean
boolean readBoolean() throws IOExceptionUnchecked
- Specified by:
readBoolean
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readBoolean()
-
readByte
byte readByte() throws IOExceptionUnchecked
- Specified by:
readByte
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readByte()
-
readUnsignedByte
int readUnsignedByte() throws IOExceptionUnchecked
- Specified by:
readUnsignedByte
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readUnsignedByte()
-
readShort
short readShort() throws IOExceptionUnchecked
- Specified by:
readShort
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readShort()
-
readUnsignedShort
int readUnsignedShort() throws IOExceptionUnchecked
- Specified by:
readUnsignedShort
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readUnsignedShort()
-
readChar
char readChar() throws IOExceptionUnchecked
- Specified by:
readChar
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readChar()
-
readInt
int readInt() throws IOExceptionUnchecked
- Specified by:
readInt
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readInt()
-
readLong
long readLong() throws IOExceptionUnchecked
- Specified by:
readLong
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readLong()
-
readFloat
float readFloat() throws IOExceptionUnchecked
- Specified by:
readFloat
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readFloat()
-
readDouble
double readDouble() throws IOExceptionUnchecked
- Specified by:
readDouble
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readDouble()
-
readLine
java.lang.String readLine() throws IOExceptionUnchecked
- Specified by:
readLine
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readLine()
-
readUTF
java.lang.String readUTF() throws IOExceptionUnchecked
- Specified by:
readUTF
in interfacejava.io.DataInput
- Throws:
IOExceptionUnchecked
- See Also:
DataInput.readUTF()
-
write
void write(int b) throws IOExceptionUnchecked
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfaceIOutputStream
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.write(int)
-
write
void write(byte[] b) throws IOExceptionUnchecked
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfaceIOutputStream
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.write(byte[])
-
write
void write(byte[] b, int off, int len) throws IOExceptionUnchecked
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in interfaceIOutputStream
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.write(byte[], int, int)
-
writeBoolean
void writeBoolean(boolean v) throws IOExceptionUnchecked
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeBoolean(boolean)
-
writeByte
void writeByte(int v) throws IOExceptionUnchecked
- Specified by:
writeByte
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeByte(int)
-
writeShort
void writeShort(int v) throws IOExceptionUnchecked
- Specified by:
writeShort
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeShort(int)
-
writeChar
void writeChar(int v) throws IOExceptionUnchecked
- Specified by:
writeChar
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeChar(int)
-
writeInt
void writeInt(int v) throws IOExceptionUnchecked
- Specified by:
writeInt
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeInt(int)
-
writeLong
void writeLong(long v) throws IOExceptionUnchecked
- Specified by:
writeLong
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeLong(long)
-
writeFloat
void writeFloat(float v) throws IOExceptionUnchecked
- Specified by:
writeFloat
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeFloat(float)
-
writeDouble
void writeDouble(double v) throws IOExceptionUnchecked
- Specified by:
writeDouble
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeDouble(double)
-
writeBytes
void writeBytes(java.lang.String s) throws IOExceptionUnchecked
- Specified by:
writeBytes
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeBytes(String)
-
writeChars
void writeChars(java.lang.String s) throws IOExceptionUnchecked
- Specified by:
writeChars
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeChars(String)
-
writeUTF
void writeUTF(java.lang.String str) throws IOExceptionUnchecked
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Throws:
IOExceptionUnchecked
- See Also:
DataOutput.writeUTF(String)
-
-