com.imagero.uio
Class RandomAccessFileWrapperRO

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

public class RandomAccessFileWrapperRO
extends AbstractRandomAccessRO

wrap RandomAccessFile in RandomAccessRO Attention - this class is not buffered. That means if you make extensive use of readInt, readLong, readChar, ..., then performance will be pretty poor. Use buffered classes instead.


Field Summary
protected  java.io.RandomAccessFile in
           
 
Fields inherited from interface com.imagero.uio.RandomAccessRO
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
RandomAccessFileWrapperRO(java.io.RandomAccessFile in, int byteOrder)
           
RandomAccessFileWrapperRO(java.io.RandomAccessFile in, long offset, int byteOrder)
           
RandomAccessFileWrapperRO(java.io.RandomAccessFile in, long offset, long length, int byteOrder)
           
 
Method Summary
protected  int _read()
           
 void close()
           
 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 read(byte[] b, int off, int len)
           
 void seek(long pos)
          set current cursor position to specified offset
 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

in

protected java.io.RandomAccessFile in
Constructor Detail

RandomAccessFileWrapperRO

public RandomAccessFileWrapperRO(java.io.RandomAccessFile in,
                                 int byteOrder)
                          throws java.io.IOException

RandomAccessFileWrapperRO

public RandomAccessFileWrapperRO(java.io.RandomAccessFile in,
                                 long offset,
                                 int byteOrder)
                          throws java.io.IOException

RandomAccessFileWrapperRO

public RandomAccessFileWrapperRO(java.io.RandomAccessFile in,
                                 long offset,
                                 long length,
                                 int byteOrder)
                          throws java.io.IOException
Method Detail

_read

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

skip

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

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] b)
         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

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
Description copied from interface: RandomAccessRO
set current cursor position to specified offset

Parameters:
pos - new cursor position
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Description copied from interface: RandomAccessRO
get length of data

Returns:
data length (in bytes)
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException