com.imagero.uio.impl
Class RandomAccessFileWrapper
java.lang.Object
java.io.InputStream
com.imagero.uio.impl.AbstractRandomAccessInput
com.imagero.uio.impl.AbstractRandomAccessIO
com.imagero.uio.impl.RandomAccessFileWrapper
- All Implemented Interfaces:
- AdvancedDataInput, AdvancedDataOutput, java.io.DataInput, java.io.DataOutput, Input, ISeekable, OSeekable, RandomAccessInput, RandomAccessIO, RandomAccessOutput
- public class RandomAccessFileWrapper
- extends AbstractRandomAccessIO
Wrap RandomAccessFile in RandomAccessIO
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.
|
Method Summary |
protected int |
_read()
|
void |
close()
|
RandomAccessInput |
createInputChild(long offset,
int byteOrder,
boolean syncPointer)
|
java.io.InputStream |
createInputStream(long offset)
|
RandomAccessIO |
createIOChild(long offset,
int byteOrder,
boolean syncPointer)
|
RandomAccessOutput |
createOutputChild(long offset,
int byteOrder,
boolean syncPointer)
|
java.io.OutputStream |
createOutputStream(long offset)
|
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 off,
int len)
|
int |
read(char[] dest,
int offset,
int length,
int byteOrder)
|
int |
read(double[] dest,
int offset,
int length,
int byteOrder)
|
int |
read(float[] dest,
int offset,
int length,
int byteOrder)
|
int |
read(int[] dest,
int offset,
int length,
int byteOrder)
|
int |
read(long[] dest,
int offset,
int length,
int byteOrder)
|
int |
read(short[] dest,
int offset,
int length,
int byteOrder)
|
void |
readFully(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.
|
long |
skip(long n)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class com.imagero.uio.impl.AbstractRandomAccessIO |
flush, transform, transform, transform, transform, transform, write, 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, writeChar, writeChars, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeLong, writeLong, writeShort, writeShort, writeUTF |
| Methods inherited from class com.imagero.uio.impl.AbstractRandomAccessInput |
getByteOrder, isBuffered, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readBoolean, readByte, readByteLine, readByteLine, readChar, readChar, readDouble, readDouble, readFloat, 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, readInt, readInt, readLine, readLong, readLong, readShort, readShort, readUnsignedByte, readUnsignedShort, readUnsignedShort, readUTF, setByteOrder, skipBytes |
| Methods inherited from class java.io.InputStream |
available, mark, markSupported, reset |
| 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.Input |
read |
| Methods inherited from interface com.imagero.uio.AdvancedDataInput |
read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, read, readByteLine, readByteLine, 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, readInt, readLong, readShort, readUnsignedShort |
| Methods inherited from interface java.io.DataInput |
readBoolean, readByte, readChar, readDouble, readFloat, 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
- Throws:
java.io.IOException
write
public void write(int 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:
ISeekable
- 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:
ISeekable
- 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:
ISeekable
- 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 long skip(long 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,
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
read
public int read(short[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
read
public int read(char[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
read
public int read(int[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
read
public int read(long[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
read
public int read(float[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
read
public int read(double[] dest,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
read in interface AdvancedDataInput- Overrides:
read in class AbstractRandomAccessInput
- Throws:
java.io.IOException
readFully
public void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
- Specified by:
readFully in interface java.io.DataInput- Overrides:
readFully in class AbstractRandomAccessInput
- Throws:
java.io.IOException
createIOChild
public RandomAccessIO createIOChild(long offset,
int byteOrder,
boolean syncPointer)
throws java.io.IOException
- Throws:
java.io.IOException
createInputChild
public RandomAccessInput createInputChild(long offset,
int byteOrder,
boolean syncPointer)
throws java.io.IOException
- Throws:
java.io.IOException
createOutputChild
public RandomAccessOutput createOutputChild(long offset,
int byteOrder,
boolean syncPointer)
throws java.io.IOException
- Throws:
java.io.IOException
createInputStream
public java.io.InputStream createInputStream(long offset)
createOutputStream
public java.io.OutputStream createOutputStream(long offset)