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

Quick Search    Search Deep

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

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

public class RandomAccessFileWrapper
extends AbstractRandomAccess

Wrap RandomAccessFile in RandomAccess
Attention - this class is not buffered. That means if you make extensive use of writeInt, writeLong, writeChar, ..., then performance will be pretty poor. Use buffered classes instead (MutableRAFBufferManager).


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)  java.io.RandomAccessFile in
           
 
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
RandomAccessFileWrapper(java.io.RandomAccessFile in, 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 offset)
          set current cursor position to specified offset
 void setLength(long newLength)
          with 1.2 and later this method works as expected, with 1.1 it can only grow the file, but can not truncate it.
 int skip(int n)
           
 void write(byte[] b)
          This method writes the raw byte array passed in to the output stream.
 void write(byte[] b, int off, int len)
          This method writes raw bytes from the passed array buf starting offset bytes into the buffer.
 void write(int b)
          This method writes an 8-bit value (passed into the method as a Java int) to an output stream.
 
Methods inherited from class com.imagero.uio.AbstractRandomAccess
_setByteOrder, setByteOrder, 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

in

java.io.RandomAccessFile in
Constructor Detail

RandomAccessFileWrapper

public RandomAccessFileWrapper(java.io.RandomAccessFile in,
                               int byteOrder)
                        throws java.io.IOException
Method Detail

_read

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

write

public void write(int b)
           throws java.io.IOException
Description copied from interface: java.io.DataOutput
This method writes an 8-bit value (passed into the method as a Java int) to an output stream. The low 8 bits of the passed value are written.


write

public void write(byte[] b)
           throws java.io.IOException
Description copied from interface: java.io.DataOutput
This method writes the raw byte array passed in to the output stream.


write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from interface: java.io.DataOutput
This method writes raw bytes from the passed array buf starting offset bytes into the buffer. The number of bytes written will be exactly len.


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


length

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


seek

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


read

public int read()
         throws java.io.IOException

skip

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

close

public void close()
           throws java.io.IOException

read

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

read

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

setLength

public void setLength(long newLength)
               throws java.io.IOException
with 1.2 and later this method works as expected, with 1.1 it can only grow the file, but can not truncate it.