Class AbstractTextDemarcator

java.lang.Object
org.apache.nifi.stream.io.util.AbstractTextDemarcator
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
LineDemarcator

public abstract class AbstractTextDemarcator extends Object implements Closeable
  • Field Details

    • INIT_BUFFER_SIZE

      private static final int INIT_BUFFER_SIZE
      See Also:
    • reader

      private final Reader reader
    • maxDataSize

      private final int maxDataSize
    • buffer

      char[] buffer
    • index

      int index
    • mark

      int mark
    • availableBytesLength

      int availableBytesLength
  • Constructor Details

    • AbstractTextDemarcator

      AbstractTextDemarcator(Reader reader, int maxDataSize)
      Constructs an instance of demarcator with provided InputStream and max buffer size. Each demarcated token must fit within max buffer size, otherwise the exception will be raised.
    • AbstractTextDemarcator

      AbstractTextDemarcator(Reader reader, int maxDataSize, int initialBufferSize)
      Constructs an instance of demarcator with provided InputStream and max buffer size and initial buffer size. Each demarcated token must fit within max buffer size, otherwise the exception will be raised.
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • fill

      void fill() throws IOException
      Will fill the current buffer from current 'index' position, expanding it and or shuffling it if necessary. If buffer exceeds max buffer size a BufferOverflowException will be thrown.
      Throws:
      IOException - if unable to read from the stream
    • validate

      private void validate(Reader reader, int maxDataSize, int initialBufferSize)
      Validates prerequisites for constructor arguments