Top Description Inners Fields Constructors Methods
com.fasterxml.jackson.dataformat.protobuf

public Class ByteAccumulator

extends Object
Class Inheritance
Imports
java.io.*

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
protected ByteAccumulator.Segment
protected ByteAccumulator.Segment
protected final ByteAccumulator
protected int
_parentStart

Pointer to start of contents provided by parent, preceding room for prefix (that is, same as or less than `_prefixOffset`)

protected final byte[]
_prefixBuffer

Caller-provided buffer in which optional type prefix, and mandatory length indicator may be added.

protected final int
_prefixOffset

Offset within _prefixBuffer where there is room for encoding prefix (type, tag, length).

protected int
_segmentBytes

Total number of bytes contained within buffers, to be used for length prefix.

protected final int

Constructor Summary

AccessConstructor and Description
public
ByteAccumulator(ByteAccumulator p, int typedTag, byte[] prefixBuffer, int prefixOffset, int parentStart)

Method Summary

Modifier and TypeMethod and Description
public void
append(byte[] buf, int offset, int len)

private void
appendAll(ByteAccumulator.Segment first, ByteAccumulator.Segment last, int segmentBytes)

public ByteAccumulator
finish(OutputStream out, byte[] input, int offset, int len)

public ByteAccumulator
finish(OutputStream out, byte[] input)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_firstSegmentback to summary
protected ByteAccumulator.Segment _firstSegment
_lastSegmentback to summary
protected ByteAccumulator.Segment _lastSegment
_parentback to summary
protected final ByteAccumulator _parent
_parentStartback to summary
protected int _parentStart

Pointer to start of contents provided by parent, preceding room for prefix (that is, same as or less than `_prefixOffset`)

Since
2.8.8
_prefixBufferback to summary
protected final byte[] _prefixBuffer

Caller-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)

_prefixOffsetback to summary
protected final int _prefixOffset

Offset within _prefixBuffer where there is room for encoding prefix (type, tag, length).

_segmentBytesback to summary
protected int _segmentBytes

Total number of bytes contained within buffers, to be used for length prefix.

_typedTagback to summary
protected final int _typedTag

Constructor Detail

ByteAccumulatorback to summary
public ByteAccumulator(ByteAccumulator p, int typedTag, byte[] prefixBuffer, int prefixOffset, int parentStart)

Method Detail

appendback to summary
public void append(byte[] buf, int offset, int len)
appendAllback to summary
private void appendAll(ByteAccumulator.Segment first, ByteAccumulator.Segment last, int segmentBytes)
finishback to summary
public ByteAccumulator finish(OutputStream out, byte[] input, int offset, int len) throws IOException
finishback to summary
public ByteAccumulator finish(OutputStream out, byte[] input) throws IOException
com.fasterxml.jackson.dataformat.protobuf back to summary

private final Class ByteAccumulator.Segment

extends Object
Class Inheritance
  • java.lang.Object
  • com.fasterxml.jackson.dataformat.protobuf.ByteAccumulator.Segment

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int
private ByteAccumulator.Segment
private final int

Constructor Summary

AccessConstructor and Description
public
Segment(byte[] buffer, int start, int length)

Method Summary

Modifier and TypeMethod and Description
public ByteAccumulator.Segment
public ByteAccumulator.Segment
next()

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_bufferback to summary
private final byte[] _buffer
_lengthback to summary
private final int _length
_nextback to summary
private ByteAccumulator.Segment _next
_startback to summary
private final int _start

Constructor Detail

Segmentback to summary
public Segment(byte[] buffer, int start, int length)

Method Detail

linkNextback to summary
public ByteAccumulator.Segment linkNext(ByteAccumulator.Segment next)
nextback to summary
public ByteAccumulator.Segment next()
writeToback to summary
public void writeTo(OutputStream out) throws IOException