Package io.protostuff
Class IOUtil
- java.lang.Object
-
- io.protostuff.IOUtil
-
final class IOUtil extends java.lang.ObjectCommon io utils for the supported formats.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateIOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static voidfillBufferFrom(java.io.InputStream in, byte[] buf, int offset, int len)Fills the byte buffer from theInputStreamwith the specified length.(package private) static intfillBufferWithDelimitedMessageFrom(java.io.InputStream in, boolean drainRemainingBytesIfTooLarge, LinkedBuffer lb)Fills the buffer based from the varint32 read from the input stream.(package private) static <T> intmergeDelimitedFrom(java.io.DataInput in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Used by the code generated messages that implementExternalizable.(package private) static <T> intmergeDelimitedFrom(java.io.InputStream in, byte[] buf, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Thebufsize limits the size of the message that must be read.(package private) static <T> intmergeDelimitedFrom(java.io.InputStream in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Merges themessage(delimited) from theInputStreamusing the givenschema.(package private) static <T> voidmergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Merges themessagewith the byte array using the givenschema.(package private) static <T> voidmergeFrom(java.io.InputStream in, byte[] buf, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Merges themessagefrom theInputStreamwith the suppliedbufto use.(package private) static <T> voidmergeFrom(java.io.InputStream in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Merges themessagefrom theInputStreamusing the givenschema.(package private) static intputVarInt32AndGetOffset(int value, byte[] buffer, int variableOffset)Returns the offset where the first byte is written.
-
-
-
Method Detail
-
mergeFrom
static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup)Merges themessagewith the byte array using the givenschema.
-
mergeFrom
static <T> void mergeFrom(java.io.InputStream in, byte[] buf, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) throws java.io.IOExceptionMerges themessagefrom theInputStreamwith the suppliedbufto use.- Throws:
java.io.IOException
-
mergeFrom
static <T> void mergeFrom(java.io.InputStream in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) throws java.io.IOExceptionMerges themessagefrom theInputStreamusing the givenschema.- Throws:
java.io.IOException
-
mergeDelimitedFrom
static <T> int mergeDelimitedFrom(java.io.InputStream in, byte[] buf, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) throws java.io.IOExceptionThebufsize limits the size of the message that must be read. A ProtobufException (sizeLimitExceeded) will be thrown if the size of the delimited message is larger.- Throws:
java.io.IOException
-
mergeDelimitedFrom
static <T> int mergeDelimitedFrom(java.io.InputStream in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) throws java.io.IOExceptionMerges themessage(delimited) from theInputStreamusing the givenschema.- Throws:
java.io.IOException
-
mergeDelimitedFrom
static <T> int mergeDelimitedFrom(java.io.DataInput in, T message, Schema<T> schema, boolean decodeNestedMessageAsGroup) throws java.io.IOExceptionUsed by the code generated messages that implementExternalizable. Merges from theDataInput.- Throws:
java.io.IOException
-
fillBufferFrom
static void fillBufferFrom(java.io.InputStream in, byte[] buf, int offset, int len) throws java.io.IOExceptionFills the byte buffer from theInputStreamwith the specified length.- Throws:
java.io.IOException
-
fillBufferWithDelimitedMessageFrom
static int fillBufferWithDelimitedMessageFrom(java.io.InputStream in, boolean drainRemainingBytesIfTooLarge, LinkedBuffer lb) throws java.io.IOExceptionFills the buffer based from the varint32 read from the input stream.The buffer's read offset is not set if the data (varint32 size + message size) is too large to fit in the buffer.
- Returns:
- the delimited size read.
- Throws:
java.io.IOException
-
putVarInt32AndGetOffset
static int putVarInt32AndGetOffset(int value, byte[] buffer, int variableOffset)Returns the offset where the first byte is written. This method assumes that 5 bytes will be writable starting at thevariableOffset.
-
-