public interface ICodec<T>
ICodec
lets you stream continuously some data (text) stream, and
truncate the data using some delimiting strategy.
The simplest is the line per line strategy.
In the two append() method, the codec must throw a 'ArrayIndexOutOfBounds' exception if the chunk size received make the current buffer exceed the maximum capacity.
Modifier and Type | Method and Description |
---|---|
default void |
append(char[] buffer,
int bytesRead)
Append a char array at the end of the codec.
|
void |
append(T s)
Append a new String into the codec.
|
default void |
flush()
flush buffer
|
List<T> |
getNextItems()
Check and return some (not necessary all) found items if any.
|
ECodec |
getType() |
default void |
tick()
Refresh the codec that require a timeout logic.
|
ECodec getType()
List<T> getNextItems()
void append(T s)
s
- the input Stringdefault void append(char[] buffer, int bytesRead)
buffer
- the holding bufferbytesRead
- the number of read bytesdefault void tick()
default void flush()
Copyright © 2022. All rights reserved.