org.planx.io
Class AbstractPositionalData

java.lang.Object
  extended by org.planx.io.AbstractPositionalData
All Implemented Interfaces:
DataInput, DataOutput, Positionable, PositionalData, PositionalDataInput, PositionalDataOutput
Direct Known Subclasses:
ByteData, FileData

public abstract class AbstractPositionalData
extends Object
implements PositionalData

Combines a DataInput and a DataOutput into a PositionalData. An implementation must provide the positioning operations specified in Positionable.

Author:
Thomas Ambus

Constructor Summary
AbstractPositionalData(DataInput in, DataOutput out)
           
 
Method Summary
abstract  SourceId id()
          Returns the current SourceId associated with the data.
 boolean isModified()
           
 boolean isReadOnly()
           
abstract  Locator location()
          Returns the current position in the data as a Locator.
abstract  long position()
          Returns the current position in the data as an long.
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
abstract  void readInto(DataOutput out, long length)
          Writes to the output length bytes from the input.
 String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 String readUTF()
           
abstract  void seek(Locator locator)
          Positions the data source at the specified locator.
abstract  void seek(long position)
          Positions the data source at the specified position.
 void setModified(boolean isModified)
           
 void setReadOnly(boolean isReadOnly)
           
 int skipBytes(int n)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
abstract  void write(DataInput in, long length)
          Writes to the output length bytes from the specified DataInput.
 void write(int b)
           
 void writeBoolean(boolean v)
           
 void writeByte(int v)
           
 void writeBytes(String s)
           
 void writeChar(int v)
           
 void writeChars(String s)
           
 void writeDouble(double v)
           
 void writeFloat(float v)
           
 void writeInt(int v)
           
 void writeLong(long v)
           
 void writeShort(int v)
           
 void writeUTF(String str)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPositionalData

public AbstractPositionalData(DataInput in,
                              DataOutput out)
Method Detail

isModified

public boolean isModified()

setModified

public void setModified(boolean isModified)

isReadOnly

public boolean isReadOnly()

setReadOnly

public void setReadOnly(boolean isReadOnly)

id

public abstract SourceId id()
                     throws IOException
Description copied from interface: Positionable
Returns the current SourceId associated with the data. That is, the SourceId of the Locator that will currently be returned by the Positionable.location() method.

Specified by:
id in interface Positionable
Throws:
IOException

location

public abstract Locator location()
                          throws IOException
Description copied from interface: Positionable
Returns the current position in the data as a Locator.

Specified by:
location in interface Positionable
Throws:
IOException - if an I/O error occurred.

position

public abstract long position()
                       throws IOException
Description copied from interface: Positionable
Returns the current position in the data as an long.

Specified by:
position in interface Positionable
Throws:
IOException - if an I/O error occurred.

seek

public abstract void seek(Locator locator)
                   throws IOException,
                          InvalidSourceIdException,
                          OutOfBoundsException
Description copied from interface: Positionable
Positions the data source at the specified locator.

Specified by:
seek in interface Positionable
Throws:
IOException - if an I/O error occurred.
InvalidSourceIdException
OutOfBoundsException

seek

public abstract void seek(long position)
                   throws IOException,
                          OutOfBoundsException
Description copied from interface: Positionable
Positions the data source at the specified position.

Specified by:
seek in interface Positionable
Throws:
IOException - if an I/O error occurred.
OutOfBoundsException

readInto

public abstract void readInto(DataOutput out,
                              long length)
                       throws IOException
Description copied from interface: PositionalDataInput
Writes to the output length bytes from the input.

Specified by:
readInto in interface PositionalDataInput
Throws:
IOException - if an I/O error occurred.

write

public abstract void write(DataInput in,
                           long length)
                    throws IOException
Description copied from interface: PositionalDataOutput
Writes to the output length bytes from the specified DataInput.

Specified by:
write in interface PositionalDataOutput
Throws:
IOException - if an I/O error occurred.

readFully

public void readFully(byte[] b)
               throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException

skipBytes

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

readBoolean

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

readByte

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

readUnsignedByte

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

readShort

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

readUnsignedShort

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

readChar

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

readInt

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

readLong

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

readFloat

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

readDouble

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

readLine

public String readLine()
                throws IOException
Specified by:
readLine in interface DataInput
Throws:
IOException

readUTF

public String readUTF()
               throws IOException
Specified by:
readUTF in interface DataInput
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException

writeBoolean

public void writeBoolean(boolean v)
                  throws IOException
Specified by:
writeBoolean in interface DataOutput
Throws:
IOException

writeByte

public void writeByte(int v)
               throws IOException
Specified by:
writeByte in interface DataOutput
Throws:
IOException

writeShort

public void writeShort(int v)
                throws IOException
Specified by:
writeShort in interface DataOutput
Throws:
IOException

writeChar

public void writeChar(int v)
               throws IOException
Specified by:
writeChar in interface DataOutput
Throws:
IOException

writeInt

public void writeInt(int v)
              throws IOException
Specified by:
writeInt in interface DataOutput
Throws:
IOException

writeLong

public void writeLong(long v)
               throws IOException
Specified by:
writeLong in interface DataOutput
Throws:
IOException

writeFloat

public void writeFloat(float v)
                throws IOException
Specified by:
writeFloat in interface DataOutput
Throws:
IOException

writeDouble

public void writeDouble(double v)
                 throws IOException
Specified by:
writeDouble in interface DataOutput
Throws:
IOException

writeBytes

public void writeBytes(String s)
                throws IOException
Specified by:
writeBytes in interface DataOutput
Throws:
IOException

writeChars

public void writeChars(String s)
                throws IOException
Specified by:
writeChars in interface DataOutput
Throws:
IOException

writeUTF

public void writeUTF(String str)
              throws IOException
Specified by:
writeUTF in interface DataOutput
Throws:
IOException


Copyright © 2004-2005 Plan-X. All Rights Reserved.