com.mucommander.io
Interface RandomAccess

All Known Implementing Classes:
BlockRandomInputStream, BufferedRandomOutputStream, FilteredRandomOutputStream, LocalFile.LocalRandomAccessInputStream, LocalFile.LocalRandomAccessOutputStream, NFSFile.NFSRandomAccessInputStream, NFSFile.NFSRandomAccessOutputStream, RandomAccessInputStream, RandomAccessOutputStream, SMBFile.SMBRandomAccessInputStream, SMBFile.SMBRandomAccessOutputStream

public interface RandomAccess

RandomAccess provides a common interface to random access streams, whether they be input or output streams.

Author:
Maxence Bernard

Method Summary
 void close()
          Closes the random access stream and releases any system resources associated with the stream.
 long getLength()
          Returns the length of the file, in bytes.
 long getOffset()
          Returns the offset (in bytes) from the beginning of the file at which the next read or write occurs.
 void seek(long offset)
          Sets the offset, measured from the beginning of the file, at which the next read or write occurs.
 

Method Detail

close

void close()
           throws java.io.IOException
Closes the random access stream and releases any system resources associated with the stream. A closed stream cannot perform input or output operations and cannot be reopened.

Throws:
java.io.IOException - if an I/O error occurs

getOffset

long getOffset()
               throws java.io.IOException
Returns the offset (in bytes) from the beginning of the file at which the next read or write occurs.

Returns:
the offset (in bytes) from the beginning of the file at which the next read or write occurs
Throws:
java.io.IOException - if an I/O error occurs.

getLength

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

Returns:
the length of the file, in bytes
Throws:
java.io.IOException - if an I/O error occurs

seek

void seek(long offset)
          throws java.io.IOException
Sets the offset, measured from the beginning of the file, at which the next read or write occurs. The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.

Parameters:
offset - the new offset position, measured in bytes from the beginning of the file
Throws:
java.io.IOException - if an I/O error occurs


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard