Class ReadableChannelWithSkipDelimiter<T extends ReadableChannel<byte[]>>

All Implemented Interfaces:
Closeable, AutoCloseable, Channel, HasArrayOps<byte[]>, ReadableChannel<byte[]>, ReadableSource<byte[]>

public class ReadableChannelWithSkipDelimiter<T extends ReadableChannel<byte[]>> extends ReadableChannelDecoratorBase<byte[],T>
Wrapper whose read method skips over the next byte delimiter (usually newline).
  • Field Details

    • delimiter

      protected final byte delimiter
    • ringBuffer

      protected RingBufferForBytes ringBuffer
    • initialSkipCount

      protected int initialSkipCount
    • remainingSkipCount

      protected int remainingSkipCount
  • Constructor Details

    • ReadableChannelWithSkipDelimiter

      public ReadableChannelWithSkipDelimiter(T delegate, byte delimiter, int initialSkipCount)
  • Method Details

    • read

      public int read(byte[] array, int position, int length) throws IOException
      Description copied from interface: ReadableSource
      Read method following the usual InputStream protocol.
      Specified by:
      read in interface ReadableSource<T extends ReadableChannel<byte[]>>
      Overrides:
      read in class ReadableChannelDecoratorBase<byte[], T extends ReadableChannel<byte[]>>
      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