Type Parameters:
A - The array type for transferring data in blocks
All Superinterfaces:
AutoCloseable, Channel, Closeable, HasArrayOps<A>
All Known Implementing Classes:
ReadableChannelBase, ReadableChannelOverSliceAccessor, ReadableChannelWithLimit

public interface ReadableChannel<A> extends HasArrayOps<A>, Channel
A data stream allows for repeated retrieval of arrays of consecutive items. Data streams can be seen as a low level generalizaton / unification of Iterators and InputStreams. Akin to an InputStream, the ReadableChannel interface does not provide a seek() method. Usually there should be another factory that creates data streams for given offsets. The reason is, that a sequential reader is typically backed by a stream of items (such as a http response, or a sql/sparql result set) and that stream needs to be re-created when jumping to arbitrary offsets.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    read(A array, int position, int length)
    Read method following the usual InputStream protocol.
    default int
    readRaw(Object array, int position, int length)
     

    Methods inherited from interface java.nio.channels.Channel

    close, isOpen

    Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.api.HasArrayOps

    getArrayOps
  • Method Details

    • read

      int read(A array, int position, int length) throws IOException
      Read method following the usual InputStream protocol.
      Parameters:
      array - The array into which to put the read data
      position - Offset into array where to start writing
      length - Maximum number of items to read.
      Returns:
      The number of items read. Return -1 if end of data was reached, and 0 iff length was 0.
      Throws:
      IOException
    • readRaw

      default int readRaw(Object array, int position, int length) throws IOException
      Throws:
      IOException