public final class ProtobufUtil extends Object
public static SerializationContext newSerializationContext()
public static SerializationContext newSerializationContext(Configuration configuration)
public static void writeTo(ImmutableSerializationContext ctx, OutputStream out, Object t) throws IOException
IOExceptionpublic static byte[] toByteArray(ImmutableSerializationContext ctx, Object t) throws IOException
IOExceptionpublic static ByteBuffer toByteBuffer(ImmutableSerializationContext ctx, Object t) throws IOException
IOExceptionpublic static <A> A readFrom(ImmutableSerializationContext ctx, InputStream in, Class<A> clazz) throws IOException
IOExceptionpublic static <A> A fromByteArray(ImmutableSerializationContext ctx, byte[] bytes, Class<A> clazz) throws IOException
IOExceptionpublic static <A> A fromByteArray(ImmutableSerializationContext ctx, byte[] bytes, int offset, int length, Class<A> clazz) throws IOException
IOExceptionpublic static <A> A fromByteBuffer(ImmutableSerializationContext ctx, ByteBuffer byteBuffer, Class<A> clazz) throws IOException
IOExceptionpublic static <A> A fromWrappedByteArray(ImmutableSerializationContext ctx, byte[] bytes) throws IOException
ctx - the serialization contextbytes - the array of bytes to parseIOException - in case parsing failspublic static <A> A fromWrappedByteArray(ImmutableSerializationContext ctx, byte[] bytes, int offset, int length) throws IOException
IOExceptionpublic static <A> A fromWrappedByteBuffer(ImmutableSerializationContext ctx, ByteBuffer byteBuffer) throws IOException
IOExceptionpublic static <A> A fromWrappedStream(ImmutableSerializationContext ctx, InputStream in) throws IOException
IOExceptionpublic static byte[] toWrappedByteArray(ImmutableSerializationContext ctx, Object t) throws IOException
IOExceptionpublic static byte[] toWrappedByteArray(ImmutableSerializationContext ctx, Object t, int bufferSize) throws IOException
IOExceptionpublic static ByteBuffer toWrappedByteBuffer(ImmutableSerializationContext ctx, Object t) throws IOException
IOExceptionpublic static void toWrappedStream(ImmutableSerializationContext ctx, OutputStream out, Object t) throws IOException
IOExceptionpublic static void toWrappedStream(ImmutableSerializationContext ctx, OutputStream out, Object t, int bufferSize) throws IOException
IOExceptionpublic static String toCanonicalJSON(ImmutableSerializationContext ctx, byte[] bytes) throws IOException
ctx - the serialization contextbytes - the Protobuf encoded message bytes to parseIOException - if I/O operations failpublic static byte[] fromCanonicalJSON(ImmutableSerializationContext ctx, Reader reader) throws IOException
IOExceptionpublic static String toCanonicalJSON(ImmutableSerializationContext ctx, byte[] bytes, boolean prettyPrint) throws IOException
ctx - the serialization contextbytes - the Protobuf encoded message bytes to parseprettyPrint - indicates if the JSON output should use a 'pretty' human-readable format or a compact formatIOException - if I/O operations failCopyright © 2020 JBoss, a division of Red Hat. All rights reserved.