Class BinaryWire
java.lang.Object
io.fluxzero.common.api.internal.BinaryWire
Allocation-bounded primitive I/O shared by compact transports and persisted messages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classUnchecked cursor for validated embedded values whose public API does not expose I/O failures.static final classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic intbytesSize(byte[] value) Returns the encoded size of one nullable length-prefixed byte array.static SerializedMessagedecodeEnvelope(byte[] bytes, int maximumValueSize) Decodes exactly one native message envelope while retaining zero-copy payload and metadata views.static List<SerializedMessage> decodeEnvelopes(byte[] bytes, int maximumValueSize) Decodes a sequence while retaining zero-copy payload and metadata views.static List<SerializedMessage> decodeEnvelopes(byte[] bytes, int offset, int length, int maximumValueSize) Decodes a native-envelope sequence from a byte range.static byte[]encodeEnvelope(SerializedMessage message) Encodes one native message envelope.static byte[]encodeEnvelopes(List<SerializedMessage> messages) Encodes a sequence of concatenated native message envelopes.static intenvelopeSize(SerializedMessage message) Returns the complete encoded size of one native message envelope.static booleanisEnvelopeSequence(byte[] bytes) Returns whether the byte sequence starts with this codec's native-envelope signature.static booleanisEnvelopeSequence(byte[] bytes, int offset, int length) Returns whether a byte range starts with this codec's native-envelope signature.static intlongsSize(long[] values) Returns the encoded size of one nullable length-prefixed long array.static intnestedEnvelopeSize(SerializedMessage message) Returns the size of a native envelope when embedded as one length-delimited wire value.static intnullableLongSize(Long value) Returns the encoded size of one nullable long.static intpeekInt(byte[] bytes, int offset) static SerializedMessageprepareEnvelope(SerializedMessage message) Prepares a message once for reuse by an enclosing transport codec.static List<SerializedMessage> prepareEnvelopes(List<SerializedMessage> messages) Prepares a message sequence, retaining the original list when every envelope is reusable.static LongreadEnvelopeIndex(byte[] bytes, int offset, int length, int maximumValueSize) Reads only the indexed routing field from one native message without materializing application data.static intreadEnvelopeSize(byte[] bytes, int offset, int length, int maximumValueSize) Returns the complete size of the next native message envelope in a byte range.static intstringSize(String value) Returns the encoded size of one nullable length-prefixed UTF-8 string.static booleanutf8Equals(byte[] bytes, int offset, int byteLength, String value) static intutf8Length(String value)
-
Method Details
-
peekInt
public static int peekInt(byte[] bytes, int offset) -
utf8Length
-
stringSize
Returns the encoded size of one nullable length-prefixed UTF-8 string. -
nullableLongSize
Returns the encoded size of one nullable long. -
bytesSize
public static int bytesSize(byte[] value) Returns the encoded size of one nullable length-prefixed byte array. -
longsSize
public static int longsSize(long[] values) Returns the encoded size of one nullable length-prefixed long array. -
envelopeSize
Returns the complete encoded size of one native message envelope. -
nestedEnvelopeSize
Returns the size of a native envelope when embedded as one length-delimited wire value. -
prepareEnvelope
Prepares a message once for reuse by an enclosing transport codec. -
prepareEnvelopes
Prepares a message sequence, retaining the original list when every envelope is reusable. -
encodeEnvelopes
Encodes a sequence of concatenated native message envelopes. -
encodeEnvelope
Encodes one native message envelope. -
decodeEnvelope
public static SerializedMessage decodeEnvelope(byte[] bytes, int maximumValueSize) throws IOException Decodes exactly one native message envelope while retaining zero-copy payload and metadata views.- Throws:
IOException
-
decodeEnvelopes
public static List<SerializedMessage> decodeEnvelopes(byte[] bytes, int maximumValueSize) throws IOException Decodes a sequence while retaining zero-copy payload and metadata views.- Throws:
IOException
-
decodeEnvelopes
public static List<SerializedMessage> decodeEnvelopes(byte[] bytes, int offset, int length, int maximumValueSize) throws IOException Decodes a native-envelope sequence from a byte range.- Throws:
IOException
-
isEnvelopeSequence
public static boolean isEnvelopeSequence(byte[] bytes) Returns whether the byte sequence starts with this codec's native-envelope signature. -
isEnvelopeSequence
public static boolean isEnvelopeSequence(byte[] bytes, int offset, int length) Returns whether a byte range starts with this codec's native-envelope signature. -
readEnvelopeSize
public static int readEnvelopeSize(byte[] bytes, int offset, int length, int maximumValueSize) throws IOException Returns the complete size of the next native message envelope in a byte range.- Throws:
IOException
-
readEnvelopeIndex
public static Long readEnvelopeIndex(byte[] bytes, int offset, int length, int maximumValueSize) throws IOException Reads only the indexed routing field from one native message without materializing application data.- Throws:
IOException
-
utf8Equals
-