Package org.capnproto
Class SerializePacked
- java.lang.Object
-
- org.capnproto.SerializePacked
-
public final class SerializePacked extends Object
Serialization using the packed encoding: https://capnproto.org/encoding.html#packing
-
-
Constructor Summary
Constructors Constructor Description SerializePacked()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MessageReaderread(BufferedInputStream input)Reads a message from the provided BufferedInputStream with default options.static MessageReaderread(BufferedInputStream input, ReaderOptions options)Reads a message from the provided BufferedInputStream with the provided options.static MessageReaderreadFromUnbuffered(ReadableByteChannel input)Wraps the provided ReadableByteChannel in a BufferedInputStream and reads a message from it with default options.static MessageReaderreadFromUnbuffered(ReadableByteChannel input, ReaderOptions options)Wraps the provided ReadableByteChannel in a BufferedInputStream and reads a message from it with the provided options.static Optional<MessageReader>tryRead(BufferedInputStream input)Attempts to read a message from the provided BufferedInputStream with default options.static Optional<MessageReader>tryRead(BufferedInputStream input, ReaderOptions options)Attempts to read a message from the provided BufferedInputStream with the provided options.static Optional<MessageReader>tryReadFromUnbuffered(ReadableByteChannel input)Wraps the provided ReadableByteChannel in a BufferedInputStream and attempts to read a message from it with default options.static Optional<MessageReader>tryReadFromUnbuffered(ReadableByteChannel input, ReaderOptions options)Wraps the provided ReadableByteChannel in a BufferedInputStream and attempts to read a message from it with the provided options.static voidwrite(BufferedOutputStream output, MessageBuilder message)Serializes a MessageBuilder to a BufferedOutputStream.static voidwrite(BufferedOutputStream output, MessageReader message)Serializes a MessageReader to a BufferedOutputStream.static voidwriteToUnbuffered(WritableByteChannel output, MessageBuilder message)Serializes a MessageBuilder to an unbuffered output stream.static voidwriteToUnbuffered(WritableByteChannel output, MessageReader message)Serializes a MessageReader to an unbuffered output stream.
-
-
-
Method Detail
-
tryRead
public static Optional<MessageReader> tryRead(BufferedInputStream input) throws IOException
Attempts to read a message from the provided BufferedInputStream with default options. Returns an empty optional if the input stream reached end-of-stream on first read.- Throws:
IOException
-
tryRead
public static Optional<MessageReader> tryRead(BufferedInputStream input, ReaderOptions options) throws IOException
Attempts to read a message from the provided BufferedInputStream with the provided options. Returns an empty optional if the input stream reached end-of-stream on first read.- Throws:
IOException
-
read
public static MessageReader read(BufferedInputStream input) throws IOException
Reads a message from the provided BufferedInputStream with default options.- Throws:
IOException
-
read
public static MessageReader read(BufferedInputStream input, ReaderOptions options) throws IOException
Reads a message from the provided BufferedInputStream with the provided options.- Throws:
IOException
-
tryReadFromUnbuffered
public static Optional<MessageReader> tryReadFromUnbuffered(ReadableByteChannel input) throws IOException
Wraps the provided ReadableByteChannel in a BufferedInputStream and attempts to read a message from it with default options. Returns an empty optional if the channel reached end-of-stream on first read.- Throws:
IOException
-
tryReadFromUnbuffered
public static Optional<MessageReader> tryReadFromUnbuffered(ReadableByteChannel input, ReaderOptions options) throws IOException
Wraps the provided ReadableByteChannel in a BufferedInputStream and attempts to read a message from it with the provided options. Returns an empty optional if the channel reached end-of-stream on first read.- Throws:
IOException
-
readFromUnbuffered
public static MessageReader readFromUnbuffered(ReadableByteChannel input) throws IOException
Wraps the provided ReadableByteChannel in a BufferedInputStream and reads a message from it with default options.- Throws:
IOException
-
readFromUnbuffered
public static MessageReader readFromUnbuffered(ReadableByteChannel input, ReaderOptions options) throws IOException
Wraps the provided ReadableByteChannel in a BufferedInputStream and reads a message from it with the provided options.- Throws:
IOException
-
write
public static void write(BufferedOutputStream output, MessageBuilder message) throws IOException
Serializes a MessageBuilder to a BufferedOutputStream.- Throws:
IOException
-
write
public static void write(BufferedOutputStream output, MessageReader message) throws IOException
Serializes a MessageReader to a BufferedOutputStream.- Throws:
IOException
-
writeToUnbuffered
public static void writeToUnbuffered(WritableByteChannel output, MessageBuilder message) throws IOException
Serializes a MessageBuilder to an unbuffered output stream.- Throws:
IOException
-
writeToUnbuffered
public static void writeToUnbuffered(WritableByteChannel output, MessageReader message) throws IOException
Serializes a MessageReader to an unbuffered output stream.- Throws:
IOException
-
-