Class ByteAccumulator
java.lang.Object
tools.jackson.dataformat.protobuf.ByteAccumulator
Helper object used for buffering content for cases where we need (byte-)length prefixes
for content like packed arrays, embedded messages, Strings and (perhaps) binary content.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected tools.jackson.dataformat.protobuf.ByteAccumulator.Segmentprotected tools.jackson.dataformat.protobuf.ByteAccumulator.Segmentprotected final ByteAccumulatorprotected intPointer to start of contents provided by parent, preceding room for prefix (that is, same as or less than `_prefixOffset`)protected final byte[]Caller-provided buffer in which optional type prefix, and mandatory length indicator may be added.protected final intOffset within_prefixBufferwhere there is room for encoding prefix (type, tag, length).protected intTotal number of bytes contained within buffers, to be used for length prefix.protected final int -
Constructor Summary
ConstructorsConstructorDescriptionByteAccumulator(ByteAccumulator p, int typedTag, byte[] prefixBuffer, int prefixOffset, int parentStart) -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(byte[] buf, int offset, int len) finish(OutputStream out, byte[] input) finish(OutputStream out, byte[] input, int offset, int len)
-
Field Details
-
_parent
-
_prefixBuffer
protected final byte[] _prefixBufferCaller-provided buffer in which optional type prefix, and mandatory length indicator may be added. Caller ensures there is enough room for both, i.e. up to 10 bytes (if both) or 5 bytes (if just length) -
_prefixOffset
protected final int _prefixOffsetOffset within_prefixBufferwhere there is room for encoding prefix (type, tag, length). -
_typedTag
protected final int _typedTag -
_firstSegment
protected tools.jackson.dataformat.protobuf.ByteAccumulator.Segment _firstSegment -
_lastSegment
protected tools.jackson.dataformat.protobuf.ByteAccumulator.Segment _lastSegment -
_segmentBytes
protected int _segmentBytesTotal number of bytes contained within buffers, to be used for length prefix. -
_parentStart
protected int _parentStartPointer to start of contents provided by parent, preceding room for prefix (that is, same as or less than `_prefixOffset`)
-
-
Constructor Details
-
ByteAccumulator
public ByteAccumulator(ByteAccumulator p, int typedTag, byte[] prefixBuffer, int prefixOffset, int parentStart)
-
-
Method Details
-
append
public void append(byte[] buf, int offset, int len) -
finish
public ByteAccumulator finish(OutputStream out, byte[] input, int offset, int len) throws IOException - Throws:
IOException
-
finish
- Throws:
IOException
-