public class BeatsDecoder extends Object
| Modifier and Type | Field and Description |
|---|---|
private Charset |
charset |
(package private) static int |
COMPRESSED_MIN_LENGTH |
private ByteArrayOutputStream |
currBytes |
private BeatsState |
currState |
private byte |
decodedFrameType |
private BeatsFrame.Builder |
frameBuilder |
(package private) static int |
JSON_MIN_LENGTH |
(package private) ComponentLog |
logger |
(package private) static int |
MIN_FRAME_HEADER_LENGTH |
private byte[] |
unprocessedData |
private long |
windowSize |
(package private) static int |
WINDOWSIZE_LENGTH |
| Constructor and Description |
|---|
BeatsDecoder(Charset charset,
ByteArrayOutputStream buffer,
ComponentLog logger) |
BeatsDecoder(Charset charset,
ComponentLog logger) |
| Modifier and Type | Method and Description |
|---|---|
List<BeatsFrame> |
getFrames()
Returns the decoded frame and resets the decoder for the next frame.
|
boolean |
process(byte currByte)
Process the next byte from the channel, updating the builder and state accordingly.
|
private void |
processFRAMETYPE(byte b) |
private void |
processPAYLOAD(byte b)
Process the outer PAYLOAD byte by byte.
|
private void |
processVERSION(byte b) |
void |
reset()
Resets this decoder back to its initial state.
|
private List<BeatsFrame> |
splitCompressedFrames(byte[] decompressedData) |
final ComponentLog logger
private BeatsFrame.Builder frameBuilder
private BeatsState currState
private byte decodedFrameType
private byte[] unprocessedData
private final Charset charset
private final ByteArrayOutputStream currBytes
private long windowSize
static final int MIN_FRAME_HEADER_LENGTH
static final int WINDOWSIZE_LENGTH
static final int COMPRESSED_MIN_LENGTH
static final int JSON_MIN_LENGTH
public BeatsDecoder(Charset charset, ComponentLog logger)
charset - the charset to decode bytes from the framepublic BeatsDecoder(Charset charset, ByteArrayOutputStream buffer, ComponentLog logger)
charset - the charset to decode bytes from the framebuffer - a buffer to use while processing the bytespublic void reset()
public boolean process(byte currByte)
throws BeatsFrameException
currByte - the next byte to processBeatsFrameExceptionpublic List<BeatsFrame> getFrames() throws BeatsFrameException
BeatsFrameExceptionprivate List<BeatsFrame> splitCompressedFrames(byte[] decompressedData)
private void processVERSION(byte b)
private void processFRAMETYPE(byte b)
private void processPAYLOAD(byte b)
splitCompressedFrames(byte[])Copyright © 2022 Apache NiFi Project. All rights reserved.