com.partnersoft.io.vfs
Interface VfsRandomAccess

All Superinterfaces:
java.io.DataInput, java.io.DataOutput
All Known Implementing Classes:
AbstractVfsRandomAccess

public interface VfsRandomAccess
extends java.io.DataInput, java.io.DataOutput

A random-access file in a Vfs.

Copyright 2004-2006 Partner Software, Inc.

Author:
Paul Reavis

Method Summary
 void close()
          Closes the file and releases any associated resources.
 VfsFile getFile()
          The VfsFile this VfsRandomAccess is accessing.
 long getLength()
          Gets the length of the file in bytes.
 long getPosition()
          The current position (aka file pointer), in bytes
 boolean isWritable()
          True if this is a read-write file.
 int read(byte[] array, int start, int length)
           
 void setLength(long newLength)
          Sets the length of the file in bytes.
 void setPosition(long newPosition)
          Sets the current position (aka file pointer) to the specified byte offset.
 void setWritable(boolean tizit)
          Attempt to set this to writable.
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 

Method Detail

getFile

VfsFile getFile()
The VfsFile this VfsRandomAccess is accessing.


isWritable

boolean isWritable()
True if this is a read-write file.


setWritable

void setWritable(boolean tizit)
Attempt to set this to writable.


setPosition

void setPosition(long newPosition)
                 throws java.io.IOException
Sets the current position (aka file pointer) to the specified byte offset.

Parameters:
newPosition - new byte offset position
Throws:
java.io.IOException - if the set fails

getPosition

long getPosition()
                 throws java.io.IOException
The current position (aka file pointer), in bytes

Returns:
current position
Throws:
java.io.IOException

setLength

void setLength(long newLength)
               throws java.io.IOException
Sets the length of the file in bytes. Truncates or extends the file as necessary. Throws an exception if the file is read-only.

Parameters:
newLength - length file will be set to.
Throws:
java.io.IOException

getLength

long getLength()
               throws java.io.IOException
Gets the length of the file in bytes.

Returns:
length of file in bytes
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Closes the file and releases any associated resources.

Throws:
java.io.IOException - if closing fails

read

int read(byte[] array,
         int start,
         int length)
         throws java.io.IOException
Throws:
java.io.IOException