public enum WireType extends Enum<WireType> implements Function<net.openhft.chronicle.bytes.Bytes<?>,Wire>, net.openhft.chronicle.core.LicenceCheck
Function<Bytes<?>, Wire>) creating a concrete Wire instance
initialised with a provided Bytes buffer.
Helper methods are supplied to obtain temporary Bytes for
serialisation operations.
| Enum Constant and Description |
|---|
BINARY
High performance binary wire format.
|
BINARY_LIGHT
High performance binary wire format optimised for speed and size.
|
COMPRESSED_BINARY
Deprecated.
|
CSV
Comma Separated Values text wire format.
|
FIELDLESS_BINARY
Compact binary wire format that omits field names.
|
JSON
JSON-compliant text wire format.
|
JSON_ONLY
JSON-compliant text wire format that uses explicit type prefixes and
text document delimiters.
|
JSONL
JSON Lines (JSONL) text wire format.
|
RAW
Raw binary wire format with minimal metadata.
|
READ_ANY
Special wire type that detects either
TEXT or BINARY
(including FIELDLESS_BINARY) by inspecting the input stream. |
TEXT
A human-readable, YAML-like text wire format.
|
YAML
YAML-compliant text wire format.
|
YAML_ONLY
YAML-compliant text wire format using text document delimiters
such as
--- and .... |
| Modifier and Type | Method and Description |
|---|---|
@Nullable Map<String,Object> |
asMap(@NotNull CharSequence cs)
Deserialises the supplied text into a
Map<String, Object>. |
String |
asString(Object marshallable)
Converts a given marshallable object to its string representation.
|
protected @NotNull String |
asUtf8String(Object marshallable)
Serialises
marshallable using this wire type into an in-memory
buffer and returns the result as a UTF-8 string. |
<T> T |
fromFile(@NotNull Class<T> expectedType,
String filename)
Deserialises an object of the given type from a file produced in this
wire format.
|
<T> T |
fromFile(String filename)
Deserialises a
Marshallable from the given file. |
<T> T |
fromString(@NotNull CharSequence cs)
Deserialises an object of an inferred type from the provided text.
|
<T> T |
fromString(Class<T> tClass,
@NotNull CharSequence cs)
Deserialises an object of the given type from the provided text.
|
boolean |
isAvailable() |
boolean |
isText()
Indicates if this WireType is of a textual nature.
|
void |
licenceCheck() |
Supplier<net.openhft.chronicle.core.values.BooleanValue> |
newBooleanReference()
Provides a supplier for a new
BooleanValue reference using BinaryBooleanReference. |
Supplier<net.openhft.chronicle.core.values.IntValue> |
newIntReference()
Provides a supplier for a new
IntValue reference using BinaryIntReference. |
Supplier<net.openhft.chronicle.core.values.LongArrayValues> |
newLongArrayReference()
Provides a supplier for a new
LongArrayValues reference using BinaryLongArrayReference. |
Supplier<net.openhft.chronicle.core.values.LongValue> |
newLongReference()
Provides a supplier for a new
LongValue reference using BinaryLongReference. |
Supplier<net.openhft.chronicle.core.values.TwoLongValue> |
newTwoLongReference()
Provides a supplier for a new
TwoLongValue reference using BinaryTwoLongReference. |
<T> @NotNull Stream<T> |
streamFromBytes(@NotNull Class<T> expectedType,
net.openhft.chronicle.bytes.Bytes<?> b)
Creates a
Stream of objects by deserialising documents from the
provided Bytes buffer. |
<T> @NotNull Stream<T> |
streamFromFile(@NotNull Class<T> expectedType,
String filename)
Deserialises objects of the given type from a file.
|
<T> @NotNull Stream<T> |
streamFromFile(String filename)
Deserialises a sequence of objects from the specified file.
|
void |
toFile(@NotNull String filename,
WriteMarshallable marshallable)
Serialises
marshallable to filename using this wire type. |
static WireType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static @Nullable WireType |
valueOf(@Nullable Wire wire)
Determines the
WireType of a given Wire. |
static WireType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final WireType TEXT
wire.testAsYaml is true it behaves like YAML.
Uses binary documents and padding by default.public static final WireType BINARY
BINARY_LIGHT.public static final WireType BINARY_LIGHT
public static final WireType FIELDLESS_BINARY
@Deprecated public static final WireType COMPRESSED_BINARY
BINARY_LIGHT.
Binary wire format that formerly supported LZW style compression for
messages exceeding COMPRESSED_SIZE.public static final WireType JSON
public static final WireType JSON_ONLY
public static final WireType JSONL
public static final WireType YAML
public static final WireType YAML_ONLY
--- and ....public static final WireType RAW
public static final WireType CSV
public static final WireType READ_ANY
TEXT or BINARY
(including FIELDLESS_BINARY) by inspecting the input stream.public static WireType[] values()
for (WireType c : WireType.values()) System.out.println(c);
public static WireType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is null@NotNull protected @NotNull String asUtf8String(Object marshallable)
marshallable using this wire type into an in-memory
buffer and returns the result as a UTF-8 string.@Nullable public static @Nullable WireType valueOf(@Nullable @Nullable Wire wire)
WireType of a given Wire. The concrete
wire is inspected and mapped to the matching enum constant.wire - the wire instance to examineWireType or null if wire is nullIllegalStateException - if the type is unknownpublic Supplier<net.openhft.chronicle.core.values.IntValue> newIntReference()
IntValue reference using BinaryIntReference.public Supplier<net.openhft.chronicle.core.values.BooleanValue> newBooleanReference()
BooleanValue reference using BinaryBooleanReference.public Supplier<net.openhft.chronicle.core.values.LongValue> newLongReference()
LongValue reference using BinaryLongReference.public Supplier<net.openhft.chronicle.core.values.TwoLongValue> newTwoLongReference()
TwoLongValue reference using BinaryTwoLongReference.public Supplier<net.openhft.chronicle.core.values.LongArrayValues> newLongArrayReference()
LongArrayValues reference using BinaryLongArrayReference.public String asString(Object marshallable)
marshallable - The object to be converted to string.@Nullable
public <T> T fromString(@NotNull
@NotNull CharSequence cs)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
T - expected typecs - text to readClassCastException - if the object is not of type Tnet.openhft.chronicle.core.io.InvalidMarshallableExceptionpublic <T> T fromString(Class<T> tClass, @NotNull @NotNull CharSequence cs) throws net.openhft.chronicle.core.io.InvalidMarshallableException
tClass - the expected typecs - text to parsenet.openhft.chronicle.core.io.InvalidMarshallableException@NotNull public <T> T fromFile(String filename) throws IOException, net.openhft.chronicle.core.io.InvalidMarshallableException
Marshallable from the given file.T - the desired typefilename - path to the input fileIOException - if the file cannot be readnet.openhft.chronicle.core.io.InvalidMarshallableException - if decoding fails@Nullable
public <T> T fromFile(@NotNull
@NotNull Class<T> expectedType,
String filename)
throws IOException,
net.openhft.chronicle.core.io.InvalidMarshallableException
T - object typeexpectedType - type to readfilename - input file pathIOException - if the file cannot be readnet.openhft.chronicle.core.io.InvalidMarshallableException - if decoding fails@NotNull public <T> @NotNull Stream<T> streamFromFile(String filename) throws IOException
T - object typefilename - file to readIOException - if the file cannot be read@NotNull public <T> @NotNull Stream<T> streamFromFile(@NotNull @NotNull Class<T> expectedType, String filename) throws IOException
T - object typeexpectedType - expected object typefilename - file to readIOException - if the file cannot be read@NotNull public <T> @NotNull Stream<T> streamFromBytes(@NotNull @NotNull Class<T> expectedType, net.openhft.chronicle.bytes.Bytes<?> b)
Stream of objects by deserialising documents from the
provided Bytes buffer.T - object typeexpectedType - expected object typeb - source bytespublic void toFile(@NotNull
@NotNull String filename,
WriteMarshallable marshallable)
throws IOException,
net.openhft.chronicle.core.io.InvalidMarshallableException
marshallable to filename using this wire type.
The data is first written to a temporary file which is then renamed for
atomicity.filename - target filemarshallable - object to writeIOException - if the file cannot be writtennet.openhft.chronicle.core.io.InvalidMarshallableException - if encoding fails@Nullable public @Nullable Map<String,Object> asMap(@NotNull @NotNull CharSequence cs) throws net.openhft.chronicle.core.io.InvalidMarshallableException
Map<String, Object>.cs - text formatted according to this wire typenet.openhft.chronicle.core.io.InvalidMarshallableException - if parsing failspublic void licenceCheck()
licenceCheck in interface net.openhft.chronicle.core.LicenceCheckpublic boolean isAvailable()
isAvailable in interface net.openhft.chronicle.core.LicenceCheckpublic boolean isText()
Copyright © 2026 Chronicle Software Ltd. All rights reserved.