public class ChrBytesUtil
extends java.lang.Object
构造器和说明 |
---|
ChrBytesUtil() |
限定符和类型 | 方法和说明 |
---|---|
static <T> T[] |
readArray(net.openhft.chronicle.bytes.BytesIn<?> bytes,
java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator,
java.util.function.IntFunction<T[]> arrayCreator)
从字节流中读取实现了 ChrBytesSerializable 接口的对象数组。
|
static int[] |
readIntArray(net.openhft.chronicle.bytes.BytesIn<?> bytes)
从字节流中读取 int 数组。
|
static <T> java.util.List<T> |
readList(net.openhft.chronicle.bytes.BytesIn<?> bytes,
java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator)
从字节流中读取泛型 List。
|
static long[] |
readLongArray(net.openhft.chronicle.bytes.BytesIn<?> bytes)
从字节流中读取 long 数组。
|
static <K,V,M extends java.util.Map<K,V>> |
readMap(net.openhft.chronicle.bytes.BytesIn<?> bytes,
java.util.function.Supplier<M> mapSupplier,
java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,K> keyCreator,
java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,V> valCreator)
从字节流中读取 Map。
|
<T> T |
readNullable(net.openhft.chronicle.bytes.BytesIn<?> bytes,
java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator)
从字节流中读取可空对象。
|
static <T extends ChrBytesSerializable> |
writeArray(net.openhft.chronicle.bytes.BytesOut<?> bytes,
T[] array)
将实现了 ChrBytesSerializable 接口的对象数组写入字节流。
|
static void |
writeIntArray(net.openhft.chronicle.bytes.BytesOut<?> bytes,
int[] ints)
将 int 数组写入字节流。
|
static <T extends ChrBytesSerializable> |
writeList(net.openhft.chronicle.bytes.BytesOut<?> bytes,
java.util.List<ChrBytesSerializable> collection)
将泛型 List 写入字节流。
|
static void |
writeLongArray(net.openhft.chronicle.bytes.BytesOut<?> bytes,
long[] longs)
将 long 数组写入字节流。
|
static <K,V> void |
writeMap(net.openhft.chronicle.bytes.BytesOut<?> bytes,
java.util.Map<K,V> map,
java.util.function.BiConsumer<net.openhft.chronicle.bytes.BytesOut<?>,K> keyMarshaller,
java.util.function.BiConsumer<net.openhft.chronicle.bytes.BytesOut<?>,V> valMarshaller)
将 Map 写入字节流。
|
<T> void |
writeNullable(net.openhft.chronicle.bytes.BytesOut<?> bytes,
T object,
java.util.function.BiConsumer<T,net.openhft.chronicle.bytes.BytesOut> marshaller)
写入可空对象到字节流。
|
public static void writeIntArray(net.openhft.chronicle.bytes.BytesOut<?> bytes, int[] ints)
bytes
- 输出流ints
- 要写入的数组public static int[] readIntArray(net.openhft.chronicle.bytes.BytesIn<?> bytes)
bytes
- 输入流public static void writeLongArray(net.openhft.chronicle.bytes.BytesOut<?> bytes, long[] longs)
bytes
- 输出流longs
- 要写入的数组public static long[] readLongArray(net.openhft.chronicle.bytes.BytesIn<?> bytes)
bytes
- 输入流public static <T extends ChrBytesSerializable> void writeArray(net.openhft.chronicle.bytes.BytesOut<?> bytes, T[] array)
T
- 泛型类型,必须实现 ChrBytesSerializable 接口bytes
- 输出流array
- 要写入的对象数组public static <T> T[] readArray(net.openhft.chronicle.bytes.BytesIn<?> bytes, java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator, java.util.function.IntFunction<T[]> arrayCreator)
T
- 泛型类型,必须实现 ChrBytesSerializable 接口bytes
- 输入流creator
- 用于创建对象的函数arrayCreator
- 用于创建数组的函数public static <T extends ChrBytesSerializable> void writeList(net.openhft.chronicle.bytes.BytesOut<?> bytes, java.util.List<ChrBytesSerializable> collection)
T
- 泛型类型bytes
- 输出流collection
- 要写入的集合public static <T> java.util.List<T> readList(net.openhft.chronicle.bytes.BytesIn<?> bytes, java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator)
T
- 泛型类型bytes
- 输入流creator
- 用于创建对象的函数public static <K,V> void writeMap(net.openhft.chronicle.bytes.BytesOut<?> bytes, java.util.Map<K,V> map, java.util.function.BiConsumer<net.openhft.chronicle.bytes.BytesOut<?>,K> keyMarshaller, java.util.function.BiConsumer<net.openhft.chronicle.bytes.BytesOut<?>,V> valMarshaller)
K
- 键的类型V
- 值的类型bytes
- 输出流map
- 要写入的映射keyMarshaller
- 键的序列化方法valMarshaller
- 值的序列化方法public static <K,V,M extends java.util.Map<K,V>> M readMap(net.openhft.chronicle.bytes.BytesIn<?> bytes, java.util.function.Supplier<M> mapSupplier, java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,K> keyCreator, java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,V> valCreator)
K
- 键的类型V
- 值的类型M
- Map 的类型bytes
- 输入流mapSupplier
- Map 的供应函数keyCreator
- 键的创建方法valCreator
- 值的创建方法public <T> void writeNullable(net.openhft.chronicle.bytes.BytesOut<?> bytes, T object, java.util.function.BiConsumer<T,net.openhft.chronicle.bytes.BytesOut> marshaller)
T
- 泛型类型bytes
- 输出流object
- 要写入的对象marshaller
- 对象的序列化方法public <T> T readNullable(net.openhft.chronicle.bytes.BytesIn<?> bytes, java.util.function.Function<net.openhft.chronicle.bytes.BytesIn,T> creator)
T
- 泛型类型bytes
- 输入流creator
- 对象的创建方法