Class BinInputReaderPipe<T>

    • Constructor Detail

      • BinInputReaderPipe

        public BinInputReaderPipe​(FailableInterruptibleSupplier<SizedInputStream,​IOException> isCreator,
                                  DecoderFactory<T> decoderFactory,
                                  int bufferSize,
                                  Compression compression)
        Constructor
        Parameters:
        isCreator - The creator of the input stream. Expected to be the raw input stream (without decompression or buffering layers), but should be initialized with expected size (see SizedInputStream). The size should be either null if unknown, or it should be the exact number of stream bytes.
        decoderFactory - The decoder of binary values to pipe items.
        bufferSize - Buffer size to use on the input stream
        compression - Input stream compression
      • BinInputReaderPipe

        public BinInputReaderPipe​(InputStream is,
                                  DecoderFactory<T> decoderFactory,
                                  int bufferSize,
                                  long sizeBytes,
                                  Compression compression)
        Constructor
        Parameters:
        is - Input stream to read items from. Expected to be the raw input stream (without decompression or buffering layers).
        decoderFactory - The decoder of binary values to pipe items.
        bufferSize - Buffer size to use on the input stream
        compression - Input stream compression
      • BinInputReaderPipe

        public BinInputReaderPipe​(SizedInputStream is,
                                  DecoderFactory<T> decoderFactory,
                                  FileReadOptions readOptions)
        Constructor
        Parameters:
        is - The SizedInputStream to read items from. Expected to be the raw input stream (without decompression or buffering layers).
        decoderFactory - The decoder of binary values to pipe items.
        readOptions - The reading options
      • BinInputReaderPipe

        public BinInputReaderPipe​(File inputFile,
                                  FileReadOptions options,
                                  DecoderFactory<T> decoderFactory)
        Constructor
        Parameters:
        inputFile - Input file to read items from
        options - The file read options
        decoderFactory - The decoder of binary values to pipe items
      • BinInputReaderPipe

        public BinInputReaderPipe​(File inputFile,
                                  DecoderFactory<T> decoderFactory)
        Constructor
        Parameters:
        inputFile - The file to read items from
        decoderFactory - The decoder of binary values to pipe items
    • Method Detail

      • next

        public T next()
               throws PipeException,
                      InterruptedException
        Returns:
        The next item in this pipe output, or null if the output end has been reached. May be a blocking operation.
        Throws:
        PipeException - In case of pipe errors in this pipe or somewhere up-stream while trying to prepare next item to return.
        InterruptedException - In case that the operation has been interrupted by another thread.
      • peek

        public T peek()
        Returns:
        The next item in the pipe's output. Does not remove it, so next call to next() will return it.
      • start

        public void start()
                   throws PipeException,
                          InterruptedException
        Description copied from interface: BasePipe
        Performs pre-processing prior to item flow throw the pipe. Implementations must call the same method for all their input pipes before accessing their items. This is typically done here.
        Specified by:
        start in interface BasePipe
        Overrides:
        start in class InputStreamPipe<T>
        Throws:
        PipeException - In case of pipe errors in this pipe or somewhere up-stream.
        InterruptedException - In case that the operation has been interrupted by another thread.