org.globus.ftp
Interface DataSource

All Known Implementing Classes:
DataSourceStream, FileRandomIO, OutputStreamDataSource

public interface DataSource

Data channel uses this interface to read outgoing data. Implement it to provide your own ways of reading data. It must be thread safe; in parallel transfer mode several streams may attempt to read.


Method Summary
 void close()
          Closes this data source and releases any system resources associated with this source.
 Buffer read()
          Reads a data buffer from this data source.
 long totalSize()
          Optional operation.
 

Method Detail

read

public Buffer read()
            throws IOException
Reads a data buffer from this data source.

Returns:
The data buffer read. Null, if there is no more data to be read.
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Closes this data source and releases any system resources associated with this source.

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

totalSize

public long totalSize()
               throws IOException
Optional operation. Returns the total size, in bytes, of the data in this source. If the implementation is not able to provide a total size for the data source, it should return -1

Throws:
IOException - if an I/O exception occurs