com.imagero.uio.bio
Class ByteArrayRandomAccessIO
java.lang.Object
java.io.InputStream
com.imagero.uio.impl.AbstractRandomAccessInput
com.imagero.uio.impl.AbstractRandomAccessIO
com.imagero.uio.bio.ByteArrayRandomAccessIO
- All Implemented Interfaces:
- AdvancedDataInput, AdvancedDataOutput, java.io.DataInput, java.io.DataOutput, Input, ISeekable, OSeekable, RandomAccessInput, RandomAccessIO, RandomAccessOutput
- public class ByteArrayRandomAccessIO
- extends AbstractRandomAccessIO
- implements RandomAccessIO
ByteArrayRandomAccessIO is like ByteArrayOutputStream and ByteArrayInputStream together.
It implements also DataInput/DataOutput and other advanced interfaces.
|
Method Summary |
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)
|
void |
flush()
|
int |
getByteOrder()
get byte order |
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 offset,
int length)
|
void |
seek(long offset)
set current cursor position to specified offset |
void |
setByteOrder(int byteOrder)
set byte order |
void |
setLength(long newLength)
Set length of stream. |
long |
skip(long n)
|
int |
skipBytes(int n)
|
byte[] |
toByteArray()
|
void |
write(byte[] b,
int offset,
int length)
|
void |
write(char[] data,
int offset,
int length,
int byteOrder)
|
void |
write(double[] data,
int offset,
int length,
int byteOrder)
|
void |
write(float[] data,
int offset,
int length,
int byteOrder)
|
void |
write(int b)
|
void |
write(int[] data,
int offset,
int length,
int byteOrder)
|
void |
write(long[] data,
int offset,
int length,
int byteOrder)
|
void |
write(short[] data,
int offset,
int length,
int byteOrder)
|
| Methods inherited from class com.imagero.uio.impl.AbstractRandomAccessIO |
transform, transform, transform, transform, transform, 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 |
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 |
| 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 |
| Methods inherited from interface com.imagero.uio.AdvancedDataOutput |
write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeShort |
| Methods inherited from interface java.io.DataOutput |
write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
ByteArrayRandomAccessIO
public ByteArrayRandomAccessIO(int initialSize)
ByteArrayRandomAccessIO
public ByteArrayRandomAccessIO(int offset,
VariableSizeByteBuffer buffer)
ByteArrayRandomAccessIO
public ByteArrayRandomAccessIO(byte[] data)
ByteArrayRandomAccessIO
public ByteArrayRandomAccessIO(VariableSizeByteBuffer buffer)
read
public int read()
throws java.io.IOException
- Specified by:
read in interface Input
- Throws:
java.io.IOException
skip
public long skip(long n)
throws java.io.IOException
- Specified by:
skip in interface Input
- Throws:
java.io.IOException
read
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Specified by:
read in interface Input
- Throws:
java.io.IOException
getByteOrder
public int getByteOrder()
- Description copied from interface:
ISeekable
- get byte order
- Specified by:
getByteOrder in interface ISeekable- Overrides:
getByteOrder in class AbstractRandomAccessInput
setByteOrder
public void setByteOrder(int byteOrder)
- Description copied from interface:
ISeekable
- set byte order
- Specified by:
setByteOrder in interface ISeekable- Overrides:
setByteOrder in class AbstractRandomAccessInput
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
- Specified by:
getFilePointer in interface ISeekable
- 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
- Specified by:
length in interface ISeekable
- Returns:
- data length (in bytes)
- Throws:
java.io.IOException
seek
public void seek(long offset)
throws java.io.IOException
- Description copied from interface:
ISeekable
- set current cursor position to specified
offset
- Specified by:
seek in interface ISeekable
- Parameters:
offset - new cursor position
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface ISeekable
- Throws:
java.io.IOException
readFully
public void readFully(byte[] b,
int offset,
int length)
throws java.io.IOException
- Specified by:
readFully in interface java.io.DataInput- Overrides:
readFully in class AbstractRandomAccessInput
- Throws:
java.io.IOException
skipBytes
public int skipBytes(int n)
throws java.io.IOException
- Specified by:
skipBytes in interface java.io.DataInput- Overrides:
skipBytes in class AbstractRandomAccessInput
- Throws:
java.io.IOException
setLength
public void setLength(long newLength)
throws java.io.IOException
- Description copied from interface:
OSeekable
- Set length of stream.
- Specified by:
setLength in interface OSeekable
- Parameters:
newLength - new stream length
- Throws:
java.io.IOException
write
public void write(int b)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput
- Throws:
java.io.IOException
write
public void write(byte[] b,
int offset,
int length)
throws java.io.IOException
- Specified by:
write in interface java.io.DataOutput
- 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
write
public void write(short[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
write
public void write(char[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
write
public void write(int[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
write
public void write(float[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
write
public void write(long[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
write
public void write(double[] data,
int offset,
int length,
int byteOrder)
throws java.io.IOException
- Specified by:
write in interface AdvancedDataOutput- Overrides:
write in class AbstractRandomAccessIO
- Throws:
java.io.IOException
createIOChild
public RandomAccessIO createIOChild(long offset,
int byteOrder,
boolean syncPointer)
- Specified by:
createIOChild in interface RandomAccessIO
createInputChild
public RandomAccessInput createInputChild(long offset,
int byteOrder,
boolean syncPointer)
- Specified by:
createInputChild in interface RandomAccessInput
createOutputChild
public RandomAccessOutput createOutputChild(long offset,
int byteOrder,
boolean syncPointer)
- Specified by:
createOutputChild in interface RandomAccessOutput
toByteArray
public byte[] toByteArray()
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface RandomAccessOutput- Overrides:
flush in class AbstractRandomAccessIO
- Throws:
java.io.IOException
createInputStream
public java.io.InputStream createInputStream(long offset)
- Specified by:
createInputStream in interface RandomAccessInput
createOutputStream
public java.io.OutputStream createOutputStream(long offset)
- Specified by:
createOutputStream in interface RandomAccessOutput