public interface WireParser extends Consumer<WireIn>
WireIn stream.
A WireParser typically maintains a set of WireParselet or
FieldNumberParselet instances, each responsible for a particular
field name or number encountered in the input. It orchestrates reading the
field identifiers and dispatches to the relevant parselet to deserialise the
value. As a Consumer<WireIn> it can
process a whole document or a sequence of events within a wire.| Modifier and Type | Field and Description |
|---|---|
static FieldNumberParselet |
SKIP_READABLE_BYTES
A predefined
FieldNumberParselet that, when invoked, consumes and
discards all remaining readable bytes in the current value or document
context of the WireIn. |
| Modifier and Type | Method and Description |
|---|---|
default void |
accept(@NotNull WireIn wireIn)
Processes an entire document or event from
wireIn. |
WireParselet |
getDefaultConsumer()
Retrieves the
WireParselet used when a field name encountered in
the input does not match any explicitly registered parselet. |
WireParselet |
lookup(CharSequence name)
Searches for the
WireParselet associated with the given field
name. |
void |
parseOne(@NotNull WireIn wireIn)
Parses a single field-value pair from the given
WireIn. |
@NotNull VanillaWireParser |
register(String keyName,
WireParselet valueInConsumer)
Registers a
WireParselet to handle fields matching the provided
keyName. |
default @NotNull VanillaWireParser |
register(WireKey key,
WireParselet valueInConsumer)
Registers a
WireParselet to handle fields matching the supplied
WireKey. |
default @NotNull VanillaWireParser |
registerOnce(WireKey key,
WireParselet valueInConsumer)
Attempts to register a new
WireParselet for the supplied key. |
static void |
skipReadable(long ignoreMethodId,
WireIn wire)
Skips all readable bytes in the provided wire.
|
static @NotNull WireParser |
wireParser(WireParselet defaultConsumer)
Creates a new
WireParser with a default consumer. |
static @NotNull WireParser |
wireParser(@NotNull WireParselet defaultConsumer,
@NotNull FieldNumberParselet fieldNumberParselet)
Creates a new
WireParser with a default consumer and a custom
field number parselet. |
static final FieldNumberParselet SKIP_READABLE_BYTES
FieldNumberParselet that, when invoked, consumes and
discards all remaining readable bytes in the current value or document
context of the WireIn. This is often used as a default handler for
unknown or uninteresting field numbers.@NotNull static @NotNull WireParser wireParser(WireParselet defaultConsumer)
WireParser with a default consumer.defaultConsumer - the WireParselet to invoke when a field name
read from the wire does not match any registered
named parselets. This typically handles unknown
fields or logs warnings.VanillaWireParser configured with the given default
consumer and SKIP_READABLE_BYTES for unknown field
numbers.@NotNull static @NotNull WireParser wireParser(@NotNull @NotNull WireParselet defaultConsumer, @NotNull @NotNull FieldNumberParselet fieldNumberParselet)
WireParser with a default consumer and a custom
field number parselet.defaultConsumer - the WireParselet for unhandled named
fields.fieldNumberParselet - the FieldNumberParselet to invoke when
a field number read from a binary wire does not
match any registered numbered parselets.VanillaWireParser instance.static void skipReadable(long ignoreMethodId,
WireIn wire)
ignoreMethodId - the method id or field number that triggered this
skip action. It is often unused by the skip logic
itself but provided for context.wire - the WireIn whose current value's readable
bytes should be skipped. This advances the read
position to the end of the current value or context.WireParselet getDefaultConsumer()
WireParselet used when a field name encountered in
the input does not match any explicitly registered parselet.void parseOne(@NotNull
@NotNull WireIn wireIn)
throws net.openhft.chronicle.core.util.InvocationTargetRuntimeException,
net.openhft.chronicle.core.io.InvalidMarshallableException
WireIn. The method
reads the field identifier (name or number) and dispatches to the
appropriate registered WireParselet or
FieldNumberParselet to deserialise the value. If no matching
parselet is found the getDefaultConsumer() or its numbered
counterpart is used.wireIn - the wire input sourcenet.openhft.chronicle.core.util.InvocationTargetRuntimeException - if invoking the target action
failsnet.openhft.chronicle.core.io.InvalidMarshallableException - if the value cannot be
deserialiseddefault void accept(@NotNull
@NotNull WireIn wireIn)
wireIn. The default
implementation repeatedly calls parseOne(WireIn) until all fields
within the current event or document have been consumed. Event boundaries
are handled using WireIn.startEvent() and
WireIn.endEvent().WireParselet lookup(CharSequence name)
WireParselet associated with the given field
name.name - the field name whose parselet is to be retrievedWireParselet, or null if none exists@NotNull default @NotNull VanillaWireParser registerOnce(WireKey key, WireParselet valueInConsumer)
WireParselet for the supplied key. If a
parselet is already registered for that key a warning is emitted and the
new registration is ignored.key - the WireKey (providing both name and code)
to associate with the parseletvalueInConsumer - the WireParselet to register for the keyWireParser instance, cast to VanillaWireParser,
for fluent configuration@NotNull default @NotNull VanillaWireParser register(WireKey key, WireParselet valueInConsumer)
WireParselet to handle fields matching the supplied
WireKey. This typically registers the parselet for both the key's
name and its code. If a parselet is already registered for the name this
may overwrite it or log a warning, depending on the implementation (see
registerOnce(net.openhft.chronicle.wire.WireKey, net.openhft.chronicle.wire.WireParselet)).key - the key to associate with the parseletvalueInConsumer - the parselet to register@NotNull @NotNull VanillaWireParser register(String keyName, WireParselet valueInConsumer)
WireParselet to handle fields matching the provided
keyName. This typically also registers the parselet for a code
derived from keyName.hashCode().keyName - the name of the key to associate with the parseletvalueInConsumer - the parselet to registerCopyright © 2026 Chronicle Software Ltd. All rights reserved.