com.imagero.uio.impl.array
Class AbstractRandomAccessArray

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.imagero.uio.impl.AbstractRandomAccessInput
          extended bycom.imagero.uio.impl.AbstractRandomAccessIO
              extended bycom.imagero.uio.impl.array.AbstractRandomAccessArray
All Implemented Interfaces:
AdvancedDataInput, AdvancedDataOutput, java.io.DataInput, java.io.DataOutput, Input, ISeekable, OSeekable, RandomAccessInput, RandomAccessIO, RandomAccessOutput
Direct Known Subclasses:
RandomAccessIntArray

public abstract class AbstractRandomAccessArray
extends AbstractRandomAccessIO


Field Summary
protected  int[] BE_SHIFTS
           
protected  int[] LE_SHIFTS
           
protected  int[] shifts
           
 
Fields inherited from class com.imagero.uio.impl.AbstractRandomAccessInput
byteOrder
 
Fields inherited from interface com.imagero.uio.ISeekable
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
AbstractRandomAccessArray(int offset, int length, int byteOrder)
           
AbstractRandomAccessArray(int offset, int length, int byteOrder, BufferPosition fp)
           
 
Method Summary
protected  int _read()
           
 void close()
           
protected  int combine(int v, int b)
           
protected  long combine(long v, int b)
           
protected abstract  IOController createController()
           
 java.io.InputStream createInputStream(long offset)
           
 java.io.OutputStream createOutputStream(long offset)
           
protected abstract  int[] createShiftBE()
           
protected abstract  int[] createShiftLE()
           
protected abstract  int getAndMask()
           
protected abstract  int getBytesPerUnit()
           
 IOController getController()
           
 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(byte[] b, int off, int len)
           
protected abstract  void readBE(int srcOffset, int count, byte[] dest, int off)
           
protected abstract  void readLE(int srcOffset, int count, byte[] dest, int off)
           
 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)
           
 void write(byte[] b, int off, int len)
           
protected abstract  void write(byte[] src, int srcOffset, int len, int destOffset, boolean bigEndian)
           
 
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, 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, readFully, readInt, readInt, readLine, readLong, readLong, readShort, readShort, readUnsignedByte, readUnsignedShort, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, 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.RandomAccessIO
createIOChild
 
Methods inherited from interface com.imagero.uio.RandomAccessInput
createInputChild
 
Methods inherited from interface com.imagero.uio.Input
read, read
 
Methods inherited from interface com.imagero.uio.ISeekable
getByteOrder, isBuffered
 
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, 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, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface com.imagero.uio.RandomAccessOutput
createOutputChild
 
Methods inherited from interface java.io.DataOutput
write
 

Field Detail

BE_SHIFTS

protected int[] BE_SHIFTS

LE_SHIFTS

protected int[] LE_SHIFTS

shifts

protected int[] shifts
Constructor Detail

AbstractRandomAccessArray

public AbstractRandomAccessArray(int offset,
                                 int length,
                                 int byteOrder)

AbstractRandomAccessArray

public AbstractRandomAccessArray(int offset,
                                 int length,
                                 int byteOrder,
                                 BufferPosition fp)
Method Detail

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

createShiftBE

protected abstract int[] createShiftBE()

createShiftLE

protected abstract int[] createShiftLE()

getBytesPerUnit

protected abstract int getBytesPerUnit()

getAndMask

protected abstract int getAndMask()

getFilePointer

public long getFilePointer()
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

length

public long length()
Description copied from interface: ISeekable
get length of data

Returns:
data length (in bytes)

seek

public void seek(long offset)
          throws java.io.IOException
Description copied from interface: ISeekable
set current cursor position to specified offset

Parameters:
offset - new cursor position
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

readBE

protected abstract void readBE(int srcOffset,
                               int count,
                               byte[] dest,
                               int off)

readLE

protected abstract void readLE(int srcOffset,
                               int count,
                               byte[] dest,
                               int off)

setLength

public void setLength(long newLength)
               throws java.io.IOException
Description copied from interface: OSeekable
Set length of stream.

Parameters:
newLength - new stream length
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException

write

protected abstract void write(byte[] src,
                              int srcOffset,
                              int len,
                              int destOffset,
                              boolean bigEndian)

combine

protected final long combine(long v,
                             int b)

combine

protected final int combine(int v,
                            int b)

_read

protected final int _read()
                   throws java.io.IOException
Throws:
java.io.IOException

createController

protected abstract IOController createController()

getController

public IOController getController()

createInputStream

public java.io.InputStream createInputStream(long offset)

createOutputStream

public java.io.OutputStream createOutputStream(long offset)