com.imagero.uio
Class RandomAccessFileWrapper
java.lang.Object
com.imagero.uio.AbstractRandomAccessRO
com.imagero.uio.AbstractRandomAccess
com.imagero.uio.RandomAccessFileWrapper
- All Implemented Interfaces:
- java.io.DataInput, java.io.DataOutput, Input, RandomAccess, RandomAccessRO
- public class RandomAccessFileWrapper
- extends AbstractRandomAccess
Wrap RandomAccessFile in RandomAccess
Attention - this class is not buffered.
That means if you make extensive use of writeInt, writeLong, writeChar, ...,
then performance will be pretty poor. Use buffered classes instead (MutableRAFBufferManager).
Method Summary |
protected int |
_read()
|
void |
close()
|
long |
getFilePointer()
Since this is an interface and is not restricted to files, "getFilePointer" is wrong name for this method.
|
long |
length()
get length of data |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
seek(long pos)
set current cursor position to specified offset |
void |
setLength(long newLength)
Set length - only possible if length was not set in constructor.
|
int |
skip(int n)
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
Methods inherited from class com.imagero.uio.AbstractRandomAccess |
_setByteOrder, setByteOrder, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from class com.imagero.uio.AbstractRandomAccessRO |
getByteOrder, readBoolean, readByte, readByteLine, readByteOrder, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.imagero.uio.RandomAccessRO |
getByteOrder, readByteLine, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully |
Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
RandomAccessFileWrapper
public RandomAccessFileWrapper(java.io.RandomAccessFile in,
int byteOrder)
throws java.io.IOException
RandomAccessFileWrapper
public RandomAccessFileWrapper(java.io.RandomAccessFile in,
long offset,
int byteOrder)
throws java.io.IOException
RandomAccessFileWrapper
public RandomAccessFileWrapper(java.io.RandomAccessFile in,
long offset,
long length,
int byteOrder)
throws java.io.IOException
_read
protected int _read()
throws java.io.IOException
- Specified by:
_read
in class AbstractRandomAccessRO
- Throws:
java.io.IOException
write
public void write(int b)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
getFilePointer
public long getFilePointer()
throws java.io.IOException
- Description copied from interface:
RandomAccessRO
- Since this is an interface and is not restricted to files, "getFilePointer" is wrong name for this method.
But I leaved it so for easier porting from RandomAccessFile
- Returns:
- current cursor position
- Throws:
java.io.IOException
length
public long length()
throws java.io.IOException
- Description copied from interface:
RandomAccessRO
- get length of data
- Returns:
- data length (in bytes)
- Throws:
java.io.IOException
seek
public void seek(long pos)
throws java.io.IOException
- Description copied from interface:
RandomAccessRO
- set current cursor position to specified
offset
- Parameters:
pos
- new cursor position
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Throws:
java.io.IOException
skip
public int skip(int n)
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Throws:
java.io.IOException
setLength
public void setLength(long newLength)
throws java.io.IOException
- Set length - only possible if length was not set in constructor.
With 1.2 and later this method works as expected,
with 1.1 it can only grow the file, but can not truncate it.
- Parameters:
newLength
-
- Throws:
java.io.IOException