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

    Modifier and Type
    Method
    Description
    void
    Closes this data source and releases any system resources associated with this source.
    Reads a data buffer from this data source.
    long
    Optional operation.
  • Method Details

    • read

      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

      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

      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