Package io.protostuff
Interface Input
-
- All Known Subinterfaces:
GraphInput
- All Known Implementing Classes:
ByteArrayInput
,ByteBufferInput
,CodedInput
,FilterInput
,GraphByteArrayInput
,GraphCodedInput
,JsonInput
,KvpByteArrayInput
,KvpInput
,XmlInput
public interface Input
An Input lets an application read primitive data types and objects from a source of data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> void
handleUnknownField(int fieldNumber, Schema<T> schema)
The underlying implementation should handle the unknown field.<T> T
mergeObject(T value, Schema<T> schema)
Merges an object(with schema) field value.boolean
readBool()
Reads a boolean field value.byte[]
readByteArray()
Reads a byte array field value.java.nio.ByteBuffer
readByteBuffer()
ByteString
readBytes()
Reads aByteString
field value.void
readBytes(java.nio.ByteBuffer bb)
Reads a field value into aByteBuffer
.double
readDouble()
Reads a double field value.int
readEnum()
Reads an enum(its number) field value.<T> int
readFieldNumber(Schema<T> schema)
Reads the field number of a message/object tied to the givenschema
.int
readFixed32()
Reads a fixed int(4 bytes) field value.long
readFixed64()
Reads a fixed long(8 bytes) field value.float
readFloat()
Reads a float field value.int
readInt32()
Reads a variable int field value.long
readInt64()
Reads a variable long field value.int
readSFixed32()
Reads a signed+fixed int(4 bytes) field value.long
readSFixed64()
Reads a signed+fixed long(8 bytes) field value.int
readSInt32()
Reads a signed int field value.long
readSInt64()
Reads a signed long field value.java.lang.String
readString()
Reads aString
field value.int
readUInt32()
Reads an unsigned int field value.long
readUInt64()
Reads an unsigned long field value.void
transferByteRangeTo(Output output, boolean utf8String, int fieldNumber, boolean repeated)
Transfer the byte range to the output.
-
-
-
Method Detail
-
handleUnknownField
<T> void handleUnknownField(int fieldNumber, Schema<T> schema) throws java.io.IOException
The underlying implementation should handle the unknown field.- Throws:
java.io.IOException
-
readFieldNumber
<T> int readFieldNumber(Schema<T> schema) throws java.io.IOException
Reads the field number of a message/object tied to the givenschema
.- Throws:
java.io.IOException
-
readInt32
int readInt32() throws java.io.IOException
Reads a variable int field value.- Throws:
java.io.IOException
-
readUInt32
int readUInt32() throws java.io.IOException
Reads an unsigned int field value.- Throws:
java.io.IOException
-
readSInt32
int readSInt32() throws java.io.IOException
Reads a signed int field value.- Throws:
java.io.IOException
-
readFixed32
int readFixed32() throws java.io.IOException
Reads a fixed int(4 bytes) field value.- Throws:
java.io.IOException
-
readSFixed32
int readSFixed32() throws java.io.IOException
Reads a signed+fixed int(4 bytes) field value.- Throws:
java.io.IOException
-
readInt64
long readInt64() throws java.io.IOException
Reads a variable long field value.- Throws:
java.io.IOException
-
readUInt64
long readUInt64() throws java.io.IOException
Reads an unsigned long field value.- Throws:
java.io.IOException
-
readSInt64
long readSInt64() throws java.io.IOException
Reads a signed long field value.- Throws:
java.io.IOException
-
readFixed64
long readFixed64() throws java.io.IOException
Reads a fixed long(8 bytes) field value.- Throws:
java.io.IOException
-
readSFixed64
long readSFixed64() throws java.io.IOException
Reads a signed+fixed long(8 bytes) field value.- Throws:
java.io.IOException
-
readFloat
float readFloat() throws java.io.IOException
Reads a float field value.- Throws:
java.io.IOException
-
readDouble
double readDouble() throws java.io.IOException
Reads a double field value.- Throws:
java.io.IOException
-
readBool
boolean readBool() throws java.io.IOException
Reads a boolean field value.- Throws:
java.io.IOException
-
readEnum
int readEnum() throws java.io.IOException
Reads an enum(its number) field value.- Throws:
java.io.IOException
-
readString
java.lang.String readString() throws java.io.IOException
Reads aString
field value.- Throws:
java.io.IOException
-
readBytes
ByteString readBytes() throws java.io.IOException
Reads aByteString
field value.- Throws:
java.io.IOException
-
readBytes
void readBytes(java.nio.ByteBuffer bb) throws java.io.IOException
Reads a field value into aByteBuffer
.- Throws:
java.io.IOException
-
readByteArray
byte[] readByteArray() throws java.io.IOException
Reads a byte array field value.- Throws:
java.io.IOException
-
readByteBuffer
java.nio.ByteBuffer readByteBuffer() throws java.io.IOException
- Throws:
java.io.IOException
-
mergeObject
<T> T mergeObject(T value, Schema<T> schema) throws java.io.IOException
Merges an object(with schema) field value. The providedschema
handles the deserialization for the object.- Throws:
java.io.IOException
-
transferByteRangeTo
void transferByteRangeTo(Output output, boolean utf8String, int fieldNumber, boolean repeated) throws java.io.IOException
Transfer the byte range to the output. Capable of zero-copy transfer depending on the type of input.- Throws:
java.io.IOException
-
-