FileRandomIO (Java Globus API)

org.globus.ftp
Class FileRandomIO

java.lang.Object
  |
  +--org.globus.ftp.FileRandomIO
All Implemented Interfaces:
DataSink, DataSource

public class FileRandomIO
extends java.lang.Object
implements DataSink, DataSource

Thread safe reference implementation of DataSink and DataSource. Implements reading and writing data to a local file.


Field Summary
protected  int bufferSize
           
static int DEFAULT_BUFFER_SIZE
           
protected  java.io.RandomAccessFile file
           
 
Constructor Summary
FileRandomIO(java.io.RandomAccessFile file)
          Behave like FileRandomIO(file, DEFAULT_BUFFER_SIZE)
FileRandomIO(java.io.RandomAccessFile file, int bufferSize)
           
 
Method Summary
 void close()
          Closes the underlying file
 Buffer read()
          In this implementation, each read() returns data sequentially.
 void write(Buffer buffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
See Also:
Constant Field Values

bufferSize

protected int bufferSize

file

protected java.io.RandomAccessFile file
Constructor Detail

FileRandomIO

public FileRandomIO(java.io.RandomAccessFile file)
Behave like FileRandomIO(file, DEFAULT_BUFFER_SIZE)

Parameters:
file - local file that will be be used as data source or destination

FileRandomIO

public FileRandomIO(java.io.RandomAccessFile file,
                    int bufferSize)
Parameters:
file - local file that will be be used as data source or destination
bufferSize - size of the buffer returned during single read operation
Method Detail

write

public void write(Buffer buffer)
           throws java.io.IOException
Specified by:
write in interface DataSink
java.io.IOException

read

public Buffer read()
            throws java.io.IOException
In this implementation, each read() returns data sequentially.

Specified by:
read in interface DataSource
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the underlying file

Specified by:
close in interface DataSink
java.io.IOException