public class VanillaWireParser extends Object implements WireParser
WireParser that maps field names or ids to
WireParselets. Named parselets are looked up via namedConsumer and
numbered fields via numberedConsumer. A defaultConsumer handles
fields that are not explicitly registered and fieldNumberParselet deals with
unmapped numeric identifiers.SKIP_READABLE_BYTES| Constructor and Description |
|---|
VanillaWireParser(@NotNull WireParselet defaultConsumer,
@NotNull FieldNumberParselet fieldNumberParselet)
Creates a parser using the supplied handlers.
|
| Modifier and Type | Method and Description |
|---|---|
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)
Returns the parselet registered for
name or null if none. |
void |
parseOne(@NotNull WireIn wireIn)
Reads one field from
wireIn. |
@NotNull VanillaWireParser |
register(String keyName,
WireParselet valueInConsumer)
Registers
valueInConsumer to handle the field named keyName. |
@NotNull VanillaWireParser |
register(@NotNull WireKey key,
WireParselet valueInConsumer)
Registers
valueInConsumer for both the text and numeric forms of
key. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, registerOnce, skipReadable, wireParser, wireParserpublic VanillaWireParser(@NotNull
@NotNull WireParselet defaultConsumer,
@NotNull
@NotNull FieldNumberParselet fieldNumberParselet)
defaultConsumer - consumer for unregistered named fields. Must not be null.fieldNumberParselet - handler for unregistered numeric ids. Must not be null.public WireParselet getDefaultConsumer()
WireParserWireParselet used when a field name encountered in
the input does not match any explicitly registered parselet.getDefaultConsumer in interface WireParserpublic void parseOne(@NotNull
@NotNull WireIn wireIn)
throws net.openhft.chronicle.core.util.InvocationTargetRuntimeException,
net.openhft.chronicle.core.io.InvalidMarshallableException
wireIn. Binary fields (identified by
BinaryWireCode.FIELD_NUMBER) are handled by
parseOneBinary(WireIn). Otherwise the field name is read into
sb and the matching parselet located via namedConsumer.
If no match is found, getDefaultConsumer() is used. The chosen
parselet and name are cached for the next call.parseOne in interface WireParserwireIn - the source of the fieldnet.openhft.chronicle.core.util.InvocationTargetRuntimeException - if a parselet throws a checked exceptionnet.openhft.chronicle.core.io.InvalidMarshallableException - if the wire data is malformed@NotNull public @NotNull VanillaWireParser register(@NotNull @NotNull WireKey key, WireParselet valueInConsumer)
valueInConsumer for both the text and numeric forms of
key.register in interface WireParserkey - the key to associate with the parseletvalueInConsumer - the parselet to register@NotNull public @NotNull VanillaWireParser register(String keyName, WireParselet valueInConsumer)
valueInConsumer to handle the field named keyName.
Also associates it with keyName.hashCode() for binary ids.register in interface WireParserkeyName - textual field namevalueInConsumer - parselet invoked for this fieldpublic WireParselet lookup(CharSequence name)
name or null if none.lookup in interface WireParsername - the field name whose parselet is to be retrievedWireParselet, or null if none existsCopyright © 2026 Chronicle Software Ltd. All rights reserved.