org.egothor.io
Class DataInputStream

java.lang.Object
  extended by org.egothor.io.DataInputStream
All Implemented Interfaces:
DataInput
Direct Known Subclasses:
DataInputOutputStream, GZipInputStream, MemoryInputStream

public abstract class DataInputStream
extends java.lang.Object
implements DataInput

This class is part of the Egothor Project

Author:
Leo Galambos

Constructor Summary
DataInputStream()
           
 
Method Summary
 void close()
          Description of the Method
abstract  int directRead(long from, byte[] arr)
          Read from the offset position without buffering.
 long getFilePointer()
          Gets the filePointer attribute of the DataInputStream object
 long getMarkPointer()
          Returns the offset of the mark if any, else returns 0.
 void jump()
           
 long length()
          Description of the Method
 void mark(long skip)
          Denote position at getFilePointer+skip for DataInput.jump().
abstract  int read(byte[] arr, int offset, int max_len)
           
 boolean readBoolean()
           
abstract  byte readByte()
          Description of the Method
abstract  int readFully(byte[] arr)
          Description of the Method
 int readInt()
          Description of the Method
 long readLong()
          Description of the Method
 long readPack7()
          Read a next long stored in a pack-7bit coding.
 int readPack7I()
          Read a next integer stored in a pack-7bit coding.
 int readShort()
          Description of the Method
 java.lang.String readString()
          Description of the Method
 java.lang.StringBuilder readString(java.lang.StringBuilder last)
          Read a next word which is saved in the prefix coding.
 void seek(long pos)
          Description of the Method
 void skipBytes(long gap)
          Description of the Method
 void skipPack7()
           
 void skipPack7I()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataInputStream

public DataInputStream()
Method Detail

getFilePointer

public long getFilePointer()
                    throws java.io.IOException
Gets the filePointer attribute of the DataInputStream object

Specified by:
getFilePointer in interface DataInput
Returns:
The filePointer value
Throws:
java.io.IOException - Description of the Exception

close

public void close()
           throws java.io.IOException
Description of the Method

Throws:
java.io.IOException - Description of the Exception

readFully

public abstract int readFully(byte[] arr)
                       throws java.io.IOException
Description of the Method

Specified by:
readFully in interface DataInput
Parameters:
arr - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

read

public abstract int read(byte[] arr,
                         int offset,
                         int max_len)
                  throws java.io.IOException
Specified by:
read in interface DataInput
Parameters:
arr - Description of the Parameter
max_len - Description of the Parameter
Returns:
number of bytes read
Throws:
java.io.IOException - Description of the Exception

readByte

public abstract byte readByte()
                       throws java.io.IOException
Description of the Method

Specified by:
readByte in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readLong

public long readLong()
              throws java.io.IOException
Description of the Method

Specified by:
readLong in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readInt

public int readInt()
            throws java.io.IOException
Description of the Method

Specified by:
readInt in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readShort

public int readShort()
              throws java.io.IOException
Description of the Method

Specified by:
readShort in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

seek

public void seek(long pos)
          throws java.io.IOException
Description of the Method

Specified by:
seek in interface DataInput
Parameters:
pos - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

length

public long length()
            throws java.io.IOException
Description of the Method

Specified by:
length in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

skipBytes

public void skipBytes(long gap)
               throws java.io.IOException
Description of the Method

Specified by:
skipBytes in interface DataInput
Parameters:
gap - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

readPack7

public final long readPack7()
                     throws java.io.IOException
Read a next long stored in a pack-7bit coding.

Specified by:
readPack7 in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

skipPack7

public final void skipPack7()
                     throws java.io.IOException
Specified by:
skipPack7 in interface DataInput
Throws:
java.io.IOException

skipPack7I

public final void skipPack7I()
                      throws java.io.IOException
Specified by:
skipPack7I in interface DataInput
Throws:
java.io.IOException

readPack7I

public final int readPack7I()
                     throws java.io.IOException
Read a next integer stored in a pack-7bit coding.

Specified by:
readPack7I in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readString

public java.lang.StringBuilder readString(java.lang.StringBuilder last)
                                   throws java.io.IOException
Read a next word which is saved in the prefix coding. This routine can demage the parameter even if the method fails.

Specified by:
readString in interface DataInput
Parameters:
last - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readString

public java.lang.String readString()
                            throws java.io.IOException
Description of the Method

Specified by:
readString in interface DataInput
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

readBoolean

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

getMarkPointer

public long getMarkPointer()
Description copied from interface: DataInput
Returns the offset of the mark if any, else returns 0.

Specified by:
getMarkPointer in interface DataInput

jump

public void jump()
          throws java.io.IOException
Specified by:
jump in interface DataInput
Throws:
java.io.IOException

mark

public void mark(long skip)
Description copied from interface: DataInput
Denote position at getFilePointer+skip for DataInput.jump().

Specified by:
mark in interface DataInput

directRead

public abstract int directRead(long from,
                               byte[] arr)
                        throws java.io.IOException
Description copied from interface: DataInput
Read from the offset position without buffering. This operation moves the read head which may collide with buffered methods.

Specified by:
directRead in interface DataInput
Throws:
java.io.IOException