Package org.globus.ftp
Class DataSourceStream
- java.lang.Object
-
- org.globus.ftp.DataSourceStream
-
- All Implemented Interfaces:
DataSource
public class DataSourceStream extends java.lang.Object implements DataSource
Reference implementation of DataSource. It can be used with non-parallel transfers. It cannot be used with Extended Block Mode because it is not thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description protected intbufferSizeprotected java.io.InputStreaminprotected longtotalRead
-
Constructor Summary
Constructors Constructor Description DataSourceStream(java.io.InputStream in)DataSourceStream(java.io.InputStream in, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this data source and releases any system resources associated with this source.Bufferread()Reads a data buffer from this data source.longtotalSize()Optional operation.
-
-
-
Method Detail
-
read
public Buffer read() throws java.io.IOException
Description copied from interface:DataSourceReads a data buffer from this data source.- Specified by:
readin interfaceDataSource- Returns:
- The data buffer read. Null, if there is no more data to be read.
- Throws:
java.io.IOException- if an I/O error occurs.
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:DataSourceCloses this data source and releases any system resources associated with this source.- Specified by:
closein interfaceDataSource- Throws:
java.io.IOException- if an I/O error occurs.
-
totalSize
public long totalSize()
Description copied from interface:DataSourceOptional 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- Specified by:
totalSizein interfaceDataSource
-
-