Package io.protostuff
Class SmileIOUtil
java.lang.Object
io.protostuff.SmileIOUtil
Smile IO utilities for messages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A custom factory simply to expose certain fields. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SmileIOUtil.Factory
The default smile factory for creating smile parsers and generators. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
Merges themessage
with the byte array using the givenschema
.static <T> void
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom
(InputStream in, T message, Schema<T> schema, boolean numeric) static <T> void
mergeFrom
(InputStream in, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) static Pipe
newPipe
(byte[] data, boolean numeric) Creates a smile pipe from a byte array.static Pipe
newPipe
(byte[] data, int offset, int length, boolean numeric) Creates a smile pipe from a byte array.static Pipe
newPipe
(InputStream in, boolean numeric) Creates a smile pipe from anInputStream
.static com.fasterxml.jackson.dataformat.smile.SmileGenerator
newSmileGenerator
(OutputStream out, byte[] buf) Creates aSmileGenerator
for the outputstream with the supplied bufoutBuffer
to use.(package private) static com.fasterxml.jackson.dataformat.smile.SmileGenerator
newSmileGenerator
(OutputStream out, byte[] buf, int offset, boolean bufferRecyclable, com.fasterxml.jackson.core.io.IOContext context) Creates aSmileGenerator
for the outputstream with the supplied bufoutBuffer
to use.static com.fasterxml.jackson.dataformat.smile.SmileParser
newSmileParser
(InputStream in, byte[] buf, int offset, int limit) Creates aSmileParser
from the inputstream with the supplied bufinBuffer
to use.(package private) static com.fasterxml.jackson.dataformat.smile.SmileParser
newSmileParser
(InputStream in, byte[] buf, int offset, int limit, boolean bufferRecyclable, com.fasterxml.jackson.core.io.IOContext context) Creates aSmileParser
from the inputstream with the supplied bufinBuffer
to use.static <T> List
<T> parseListFrom
(InputStream in, Schema<T> schema, boolean numeric) Parses themessages
from the stream using the givenschema
.static <T> List
<T> parseListFrom
(InputStream in, Schema<T> schema, boolean numeric, LinkedBuffer buffer) Parses themessages
from the stream using the givenschema
.static <T> byte[]
toByteArray
(T message, Schema<T> schema, boolean numeric) Serializes themessage
into a byte array using the givenschema
.static <T> byte[]
toByteArray
(T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) Serializes themessage
into a byte array using the givenschema
.static <T> void
writeListTo
(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric) Serializes themessages
into the stream using the given schema.static <T> void
writeListTo
(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric, LinkedBuffer buffer) Serializes themessages
into the stream using the given schema.static <T> void
writeTo
(OutputStream out, T message, Schema<T> schema, boolean numeric) static <T> void
writeTo
(OutputStream out, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer)
-
Field Details
-
DEFAULT_SMILE_FACTORY
The default smile factory for creating smile parsers and generators.
-
-
Constructor Details
-
SmileIOUtil
private SmileIOUtil()
-
-
Method Details
-
newPipe
Creates a smile pipe from a byte array.- Throws:
IOException
-
newPipe
Creates a smile pipe from a byte array.- Throws:
IOException
-
newPipe
Creates a smile pipe from anInputStream
.- Throws:
IOException
-
newSmileParser
public static com.fasterxml.jackson.dataformat.smile.SmileParser newSmileParser(InputStream in, byte[] buf, int offset, int limit) throws IOException Creates aSmileParser
from the inputstream with the supplied bufinBuffer
to use.- Throws:
IOException
-
newSmileParser
static com.fasterxml.jackson.dataformat.smile.SmileParser newSmileParser(InputStream in, byte[] buf, int offset, int limit, boolean bufferRecyclable, com.fasterxml.jackson.core.io.IOContext context) throws IOException Creates aSmileParser
from the inputstream with the supplied bufinBuffer
to use.- Throws:
IOException
-
newSmileGenerator
public static com.fasterxml.jackson.dataformat.smile.SmileGenerator newSmileGenerator(OutputStream out, byte[] buf) Creates aSmileGenerator
for the outputstream with the supplied bufoutBuffer
to use. -
newSmileGenerator
static com.fasterxml.jackson.dataformat.smile.SmileGenerator newSmileGenerator(OutputStream out, byte[] buf, int offset, boolean bufferRecyclable, com.fasterxml.jackson.core.io.IOContext context) Creates aSmileGenerator
for the outputstream with the supplied bufoutBuffer
to use. -
mergeFrom
public static <T> void mergeFrom(byte[] data, T message, Schema<T> schema, boolean numeric) throws IOException Merges themessage
with the byte array using the givenschema
.- Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean numeric) throws IOException Merges themessage
with the byte array using the givenschema
.- Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, boolean numeric) throws IOException - Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException Merges themessage
from theInputStream
using the givenschema
.The
LinkedBuffer
's internal byte array will be used when reading the message.- Throws:
IOException
-
toByteArray
Serializes themessage
into a byte array using the givenschema
. -
toByteArray
public static <T> byte[] toByteArray(T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) Serializes themessage
into a byte array using the givenschema
.The
LinkedBuffer
's internal byte array will be used as the primary buffer when writing the message. -
writeTo
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric) throws IOException - Throws:
IOException
-
writeTo
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException Serializes themessage
into anOutputStream
using the givenschema
.The
LinkedBuffer
's internal byte array will be used as the primary buffer when writing the message.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric) throws IOException Serializes themessages
into the stream using the given schema.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException Serializes themessages
into the stream using the given schema.The
LinkedBuffer
's internal byte array will be used as the primary buffer when writing the message.- Throws:
IOException
-
parseListFrom
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric) throws IOException Parses themessages
from the stream using the givenschema
.- Throws:
IOException
-
parseListFrom
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException Parses themessages
from the stream using the givenschema
.The
LinkedBuffer
's internal byte array will be used when reading the message.- Throws:
IOException
-