com.imagero.uio
Class RandomAccessBufferRO

java.lang.Object
  extended bycom.imagero.uio.AbstractRandomAccessRO
      extended bycom.imagero.uio.RandomAccessBufferRO
All Implemented Interfaces:
java.io.DataInput, Input, RandomAccessRO

public class RandomAccessBufferRO
extends AbstractRandomAccessRO

Represent (multiple) Buffer as RandomAccessRO


Field Summary
protected  BufferManager bufferManager
           
 
Fields inherited from interface com.imagero.uio.RandomAccessRO
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
RandomAccessBufferRO(Buffer[] buffer, int byteOrder)
          create new RABuffer
RandomAccessBufferRO(BufferManager sourceManager, int byteOrder)
          create new RABuffer
 
Method Summary
protected  int _read()
           
 void close()
           
 BufferManager getBufferManager()
           
 long getFilePointer()
          Since this is an interface and is not restricted to files, "getFilePointer" is wrong name for this method.
 long length()
          Returns the data length (please note, that real length is not always known)
protected  boolean nextArray()
           
 int read()
          Reads a byte of data from this byte array.
 int read(byte[] b)
           
 int read(byte[] b, int off, int length)
           
 void seek(long pos)
          Sets the pointer offset, measured in bytes from the begin of the data, at which the next read or write occurs.
 int skip(int n)
           
 
Methods inherited from class com.imagero.uio.AbstractRandomAccessRO
_setByteOrder, 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, setByteOrder, skipBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bufferManager

protected BufferManager bufferManager
Constructor Detail

RandomAccessBufferRO

public RandomAccessBufferRO(Buffer[] buffer,
                            int byteOrder)
                     throws java.io.IOException
create new RABuffer

Throws:
java.io.IOException

RandomAccessBufferRO

public RandomAccessBufferRO(BufferManager sourceManager,
                            int byteOrder)
                     throws java.io.IOException
create new RABuffer

Parameters:
sourceManager -
Throws:
java.io.IOException
Method Detail

getBufferManager

public BufferManager getBufferManager()

read

public int read()
         throws java.io.IOException
Reads a byte of data from this byte array. The byte is returned as an integer in the range 0 to 255 (0x00-0x0ff).

Returns:
the next byte of data, or -1 if the end of the file has been reached.
Throws:
java.io.IOException

nextArray

protected boolean nextArray()
                     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

seek

public void seek(long pos)
          throws java.io.IOException
Sets the pointer offset, measured in bytes from the begin of the data, at which the next read or write occurs.

Parameters:
pos - the offset position, measured in bytes from the begin of the data, at which to set the pointer.
Throws:
java.io.IOException

length

public long length()
Returns the data length (please note, that real length is not always known)

Returns:
the data length, measured in bytes.

read

public int read(byte[] b)
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int length)
         throws java.io.IOException
Throws:
java.io.IOException

close

public void close()

skip

public int skip(int n)
         throws java.io.IOException
Throws:
java.io.IOException

_read

protected int _read()
             throws java.io.IOException
Specified by:
_read in class AbstractRandomAccessRO
Throws:
java.io.IOException