abstract class AbstractDemarcator extends Object implements Closeable
NOTE: Not intended for multi-thread usage hence not Thread-safe.
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
availableBytesLength |
(package private) byte[] |
buffer |
(package private) int |
index |
(package private) static int |
INIT_BUFFER_SIZE |
private int |
initialBufferSize |
private InputStream |
is |
(package private) int |
mark |
private int |
maxDataSize |
(package private) long |
offset |
| Constructor and Description |
|---|
AbstractDemarcator(InputStream is,
int maxDataSize)
Constructs an instance of demarcator with provided
InputStream
and max buffer size. |
AbstractDemarcator(InputStream is,
int maxDataSize,
int initialBufferSize)
Constructs an instance of demarcator with provided
InputStream
and max buffer size and initial buffer size. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
(package private) byte[] |
extractDataToken(int length)
Will extract data token of the provided length from the current buffer
starting at the 'mark'.
|
(package private) void |
fill()
Will fill the current buffer from current 'index' position, expanding it
and or shuffling it if necessary.
|
private void |
validate(InputStream is,
int maxDataSize,
int initialBufferSize)
Validates prerequisites for constructor arguments
|
static final int INIT_BUFFER_SIZE
private final InputStream is
private final int initialBufferSize
private final int maxDataSize
byte[] buffer
int index
int mark
long offset
int availableBytesLength
AbstractDemarcator(InputStream is, int maxDataSize)
InputStream
and max buffer size. Each demarcated token must fit within max buffer
size, otherwise the exception will be raised.AbstractDemarcator(InputStream is, int maxDataSize, int initialBufferSize)
InputStream
and max buffer size and initial buffer size. Each demarcated token must
fit within max buffer size, otherwise the exception will be raised.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionvoid fill() throws IOException
TokenTooLargeException will be thrown.IOException - if unable to read from the streambyte[] extractDataToken(int length)
throws IOException
IOExceptionprivate void validate(InputStream is, int maxDataSize, int initialBufferSize)
Copyright © 2023 Apache NiFi Project. All rights reserved.