org.galagosearch.tupleflow
Class BufferedFileDataStream

java.lang.Object
  extended by org.galagosearch.tupleflow.BufferedFileDataStream
All Implemented Interfaces:
java.io.DataInput, DataStream

public class BufferedFileDataStream
extends java.lang.Object
implements DataStream

Author:
trevor

Constructor Summary
BufferedFileDataStream(java.io.RandomAccessFile stream, long stopPosition)
          Creates a new instance of BufferedFileDataStream
BufferedFileDataStream(java.io.RandomAccessFile stream, long start, long end)
           
 
Method Summary
 long getAbsolutePosition()
           
 long getPosition()
           
 boolean isDone()
           
 long length()
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] buffer)
           
 void readFully(byte[] buffer, int start, int length)
           
 int readInt()
           
 java.lang.String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 java.lang.String readUTF()
           
 void seek(long offset)
          Seeks forward into the stream to a particular byte offset (reverse seeks are not allowed).
 void seekAbsolute(long offset)
          Seeks forward into the stream to a particular byte offset (reverse seeks are not allowed).
 int skipBytes(int n)
           
 BufferedFileDataStream subStream(long start, long length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedFileDataStream

public BufferedFileDataStream(java.io.RandomAccessFile stream,
                              long stopPosition)
                       throws java.io.IOException
Creates a new instance of BufferedFileDataStream

Throws:
java.io.IOException

BufferedFileDataStream

public BufferedFileDataStream(java.io.RandomAccessFile stream,
                              long start,
                              long end)
Method Detail

subStream

public BufferedFileDataStream subStream(long start,
                                        long length)
Specified by:
subStream in interface DataStream

isDone

public boolean isDone()
Specified by:
isDone in interface DataStream

length

public long length()
Specified by:
length in interface DataStream

getPosition

public long getPosition()
Specified by:
getPosition in interface DataStream

getAbsolutePosition

public long getAbsolutePosition()

seek

public void seek(long offset)
Seeks forward into the stream to a particular byte offset (reverse seeks are not allowed). The offset is relative to the start position of this data stream, not the beginning of the file.

Specified by:
seek in interface DataStream

seekAbsolute

public void seekAbsolute(long offset)
Seeks forward into the stream to a particular byte offset (reverse seeks are not allowed). The offset is relative to the start of the file.


readFully

public void readFully(byte[] buffer,
                      int start,
                      int length)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

readFully

public void readFully(byte[] buffer)
               throws java.io.IOException
Specified by:
readFully in interface java.io.DataInput
Throws:
java.io.IOException

skipBytes

public int skipBytes(int n)
              throws java.io.IOException
Specified by:
skipBytes in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedShort

public int readUnsignedShort()
                      throws java.io.IOException
Specified by:
readUnsignedShort in interface java.io.DataInput
Throws:
java.io.IOException

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Specified by:
readBoolean in interface java.io.DataInput
Throws:
java.io.IOException

readByte

public byte readByte()
              throws java.io.IOException
Specified by:
readByte in interface java.io.DataInput
Throws:
java.io.IOException

readChar

public char readChar()
              throws java.io.IOException
Specified by:
readChar in interface java.io.DataInput
Throws:
java.io.IOException

readShort

public short readShort()
                throws java.io.IOException
Specified by:
readShort in interface java.io.DataInput
Throws:
java.io.IOException

readDouble

public double readDouble()
                  throws java.io.IOException
Specified by:
readDouble in interface java.io.DataInput
Throws:
java.io.IOException

readFloat

public float readFloat()
                throws java.io.IOException
Specified by:
readFloat in interface java.io.DataInput
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Specified by:
readInt in interface java.io.DataInput
Throws:
java.io.IOException

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Specified by:
readLine in interface java.io.DataInput
Throws:
java.io.IOException

readLong

public long readLong()
              throws java.io.IOException
Specified by:
readLong in interface java.io.DataInput
Throws:
java.io.IOException

readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
Specified by:
readUTF in interface java.io.DataInput
Throws:
java.io.IOException

readUnsignedByte

public int readUnsignedByte()
                     throws java.io.IOException
Specified by:
readUnsignedByte in interface java.io.DataInput
Throws:
java.io.IOException


Copyright © 2009. All Rights Reserved.