org.h2.store.fs
Interface FileObject

All Known Implementing Classes:
FileObjectDisk, FileObjectDiskChannel, FileObjectDiskMapped, FileObjectMemory, FileObjectSplit, FileObjectZip

public interface FileObject

This interface represents a random access file.


Method Summary
 void close()
          Close the file.
 long getFilePointer()
          Get the file pointer.
 java.lang.String getName()
          Get the full qualified name of this file.
 long length()
          Get the length of the file.
 void readFully(byte[] b, int off, int len)
          Read from the file.
 void releaseLock()
          Release the file lock.
 void seek(long pos)
          Go to the specified position in the file.
 void setFileLength(long newLength)
          Change the length of the file.
 void sync()
          Force changes to the physical location.
 boolean tryLock()
          Try to lock the file exclusively.
 void write(byte[] b, int off, int len)
          Write to the file.
 

Method Detail

length

long length()
            throws java.io.IOException
Get the length of the file.

Returns:
the length
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Close the file.

Throws:
java.io.IOException

readFully

void readFully(byte[] b,
               int off,
               int len)
               throws java.io.IOException
Read from the file.

Parameters:
b - the byte array
off - the offset
len - the number of bytes
Throws:
java.io.IOException

seek

void seek(long pos)
          throws java.io.IOException
Go to the specified position in the file.

Parameters:
pos - the new position
Throws:
java.io.IOException

write

void write(byte[] b,
           int off,
           int len)
           throws java.io.IOException
Write to the file.

Parameters:
b - the byte array
off - the offset
len - the number of bytes
Throws:
java.io.IOException

getFilePointer

long getFilePointer()
                    throws java.io.IOException
Get the file pointer.

Returns:
the current file pointer
Throws:
java.io.IOException

sync

void sync()
          throws java.io.IOException
Force changes to the physical location.

Throws:
java.io.IOException

setFileLength

void setFileLength(long newLength)
                   throws java.io.IOException
Change the length of the file.

Parameters:
newLength - the new length
Throws:
java.io.IOException

getName

java.lang.String getName()
Get the full qualified name of this file.

Returns:
the name

tryLock

boolean tryLock()
Try to lock the file exclusively.

Returns:
true if locking was successful

releaseLock

void releaseLock()
Release the file lock.