Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.imagero.uio
Class RandomAccessBuffer  view RandomAccessBuffer download RandomAccessBuffer.java

java.lang.Object
  extended bycom.imagero.uio.AbstractRandomAccessRO
      extended bycom.imagero.uio.AbstractRandomAccess
          extended bycom.imagero.uio.RandomAccessBuffer
All Implemented Interfaces:
java.io.DataInput, java.io.DataOutput, Input, RandomAccess, RandomAccessRO

public class RandomAccessBuffer
extends AbstractRandomAccess

Makes possible to represent (multiple) Buffers as RandomAccess


Nested Class Summary
 
Nested classes inherited from class com.imagero.uio.AbstractRandomAccess
AbstractRandomAccess.DataOutputBE, AbstractRandomAccess.DataOutputLE
 
Nested classes inherited from class com.imagero.uio.AbstractRandomAccessRO
AbstractRandomAccessRO.DataInputBE, AbstractRandomAccessRO.DataInputLE
 
Field Summary
(package private)  byte[] buf
           
(package private)  com.imagero.uio.buffer.MutableBufferManager bufferManager
           
(package private)  int dataIndex
           
(package private)  boolean dirty
           
(package private)  int fp
           
 
Fields inherited from class com.imagero.uio.AbstractRandomAccess
dataOutput
 
Fields inherited from class com.imagero.uio.AbstractRandomAccessRO
byteOrder, dataInput
 
Fields inherited from interface com.imagero.uio.RandomAccessRO
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
RandomAccessBuffer(com.imagero.uio.buffer.Buffer[] ds, int byteOrder)
          create new RABuffer
RandomAccessBuffer(com.imagero.uio.buffer.MutableBufferManager bufferManager, int byteOrder)
          create new RABuffer
 
Method Summary
protected  int _read()
           
protected  void _setByteOrder(int byteOrder)
          not all images are tiffs, so we don't throw exception if called from constructor
 void close()
          sets dirty flag in bufferManager and closes it
 void flush()
           
 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)
           
private  int readBytes(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.
 void setByteOrder(int byteOrder)
          set byte order
 void setLength(long newLength)
          just ignored, no exception is thrown
 int skip(int n)
           
 void write(byte[] b)
          Writes max b.length bytes from the specified byte array to this array, starting at the current array pointer.
 void write(byte[] b, int off, int length)
          Writes len bytes from the specified byte array starting at offset off to this RandomAccess.

This method doesn't write beyond array bounds, but off and length are not checked.

 void write(int b)
          Writes the specified byte to this array.
private  int writeBytes(byte[] b, int off, int length)
           
 
Methods inherited from class com.imagero.uio.AbstractRandomAccess
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
 

Field Detail

bufferManager

com.imagero.uio.buffer.MutableBufferManager bufferManager

dataIndex

int dataIndex

fp

int fp

buf

byte[] buf

dirty

boolean dirty
Constructor Detail

RandomAccessBuffer

public RandomAccessBuffer(com.imagero.uio.buffer.Buffer[] ds,
                          int byteOrder)
                   throws java.io.IOException
create new RABuffer


RandomAccessBuffer

public RandomAccessBuffer(com.imagero.uio.buffer.MutableBufferManager bufferManager,
                          int byteOrder)
                   throws java.io.IOException
create new RABuffer

Method Detail

read

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


nextArray

protected boolean nextArray()

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


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.


length

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


setLength

public void setLength(long newLength)
               throws java.io.IOException
just ignored, no exception is thrown


read

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

read

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

readBytes

private int readBytes(byte[] b,
                      int off,
                      int length)

write

public void write(byte[] b)
           throws java.io.IOException
Writes max b.length bytes from the specified byte array to this array, starting at the current array pointer.

This method doesn't write beyond array bounds, but off and length are not checked.


write

public void write(byte[] b,
                  int off,
                  int length)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this RandomAccess.

This method doesn't write beyond array bounds, but off and length are not checked.


flush

public void flush()
           throws java.io.IOException

setByteOrder

public void setByteOrder(int byteOrder)
                  throws java.io.IOException
Description copied from interface: RandomAccessRO
set byte order

Specified by:
setByteOrder in interface RandomAccessRO
Overrides:
setByteOrder in class AbstractRandomAccess

_setByteOrder

protected void _setByteOrder(int byteOrder)
                      throws java.io.IOException
Description copied from class: AbstractRandomAccess
not all images are tiffs, so we don't throw exception if called from constructor

Overrides:
_setByteOrder in class AbstractRandomAccess

writeBytes

private int writeBytes(byte[] b,
                       int off,
                       int length)

write

public void write(int b)
           throws java.io.IOException
Writes the specified byte to this array. The write starts at the current array pointer.


close

public void close()
sets dirty flag in bufferManager and closes it


skip

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

_read

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