org.planx.io
Class FileData

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

public class FileData
extends AbstractPositionalData

A PositionalData source that uses a File as data.

Author:
Thomas Ambus

Constructor Summary
FileData(File file)
           
FileData(File file, SourceId id)
           
FileData(String name)
           
FileData(String name, SourceId id)
           
 
Method Summary
 void close()
           
 SourceId id()
          Returns the current SourceId associated with the data.
 Locator location()
          Returns the current position in the data as a Locator.
 long position()
          Returns the current position in the data as an long.
 void readInto(DataOutput out, long length)
          Writes to the output length bytes from the input.
 void seek(Locator l)
          Positions the data source at the specified locator.
 void seek(long pos)
          Positions the data source at the specified position.
 void setId(SourceId id)
           
 void setSize(long size)
           
 long size()
           
 void write(DataInput in, long length)
          Writes to the output length bytes from the specified DataInput.
 
Methods inherited from class org.planx.io.AbstractPositionalData
isModified, isReadOnly, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setModified, setReadOnly, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileData

public FileData(File file)
         throws IOException
Throws:
IOException

FileData

public FileData(String name)
         throws IOException
Throws:
IOException

FileData

public FileData(File file,
                SourceId id)
         throws IOException
Throws:
IOException

FileData

public FileData(String name,
                SourceId id)
         throws IOException
Throws:
IOException
Method Detail

close

public void close()
           throws IOException
Throws:
IOException

setId

public void setId(SourceId id)

id

public SourceId id()
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
Specified by:
id in class AbstractPositionalData

readInto

public 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
Specified by:
readInto in class AbstractPositionalData
Throws:
IOException - if an I/O error occurred.

write

public 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
Specified by:
write in class AbstractPositionalData
Throws:
IOException - if an I/O error occurred.

size

public long size()
          throws IOException
Throws:
IOException

setSize

public void setSize(long size)
             throws IOException
Throws:
IOException

location

public 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
Specified by:
location in class AbstractPositionalData
Throws:
IOException - if an I/O error occurred.

position

public 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
Specified by:
position in class AbstractPositionalData
Throws:
IOException - if an I/O error occurred.

seek

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

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

seek

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

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


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