Package org.infinispan.protostream.impl
Class TagReaderImpl
java.lang.Object
org.infinispan.protostream.impl.TagReaderImpl
- All Implemented Interfaces:
ProtobufTagMarshaller.OperationContext
,ProtobufTagMarshaller.ReadContext
,TagReader
public final class TagReaderImpl
extends Object
implements TagReader, ProtobufTagMarshaller.ReadContext
- Since:
- 3.0
- Author:
- [email protected]
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkLastTagWas
(int tag) Checks that the previously read tag is the last tag of a message or group.byte[]
Returns the full buffer array allowing an alternative protobuf parser to be used in marshallers, and at the root message level.Returns the input stream allowing an alternative protobuf parser to be used in marshallers, and at the root message level.org.infinispan.protostream.impl.ProtoStreamReaderImpl
Provides access to theImmutableSerializationContext
.boolean
isAtEnd()
Returns true if we have reached the end of input or the limit set with pushLimit.boolean
static TagReaderImpl
newInstance
(ImmutableSerializationContext serCtx, byte[] buf) static TagReaderImpl
newInstance
(ImmutableSerializationContext serCtx, byte[] buf, int offset, int length) static TagReaderImpl
newInstance
(ImmutableSerializationContext serCtx, InputStream input) static TagReaderImpl
newInstance
(ImmutableSerializationContext serCtx, ByteBuffer buf) static TagReaderImpl
newNestedInstance
(ProtobufTagMarshaller.ReadContext parent, byte[] buf) static TagReaderImpl
newNestedInstance
(ProtobufTagMarshaller.ReadContext parent, InputStream input) void
popLimit
(int oldLimit) Returns back to a previous limit returned by pushLimit.int
pushLimit
(int limit) Sets a limit (based on the length of the length delimited value) when entering an embedded message.boolean
readBool()
byte[]
Reads abytes
value as a byte array.Reads abytes
value as a ByteBuffer.double
int
readEnum()
int
long
float
int
long
int
long
int
long
Reads astring
value.int
readTag()
Reads a tag and returns it or returns 0 in case the input data is finished.int
long
void
boolean
skipField
(int tag) Skips a tag+value pair and returns true for normal tags but if the tag is an end group tag it returns false.
-
Method Details
-
newNestedInstance
public static TagReaderImpl newNestedInstance(ProtobufTagMarshaller.ReadContext parent, InputStream input) -
newNestedInstance
-
newInstance
-
newInstance
-
newInstance
-
newInstance
public static TagReaderImpl newInstance(ImmutableSerializationContext serCtx, byte[] buf, int offset, int length) -
isAtEnd
Description copied from interface:TagReader
Returns true if we have reached the end of input or the limit set with pushLimit.- Specified by:
isAtEnd
in interfaceTagReader
- Throws:
IOException
-
readTag
Description copied from interface:TagReader
Reads a tag and returns it or returns 0 in case the input data is finished.- Specified by:
readTag
in interfaceTagReader
- Throws:
IOException
-
checkLastTagWas
Description copied from interface:TagReader
Checks that the previously read tag is the last tag of a message or group. The expected tag should be either 0 or an end group tag.- Specified by:
checkLastTagWas
in interfaceTagReader
- Throws:
IOException
-
skipField
Description copied from interface:TagReader
Skips a tag+value pair and returns true for normal tags but if the tag is an end group tag it returns false.- Specified by:
skipField
in interfaceTagReader
- Throws:
IOException
-
readUInt64
- Specified by:
readUInt64
in interfaceTagReader
- Throws:
IOException
-
readInt64
- Specified by:
readInt64
in interfaceTagReader
- Throws:
IOException
-
readInt32
- Specified by:
readInt32
in interfaceTagReader
- Throws:
IOException
-
readFixed64
- Specified by:
readFixed64
in interfaceTagReader
- Throws:
IOException
-
readFixed32
- Specified by:
readFixed32
in interfaceTagReader
- Throws:
IOException
-
readDouble
- Specified by:
readDouble
in interfaceTagReader
- Throws:
IOException
-
readFloat
- Specified by:
readFloat
in interfaceTagReader
- Throws:
IOException
-
readBool
- Specified by:
readBool
in interfaceTagReader
- Throws:
IOException
-
readString
Description copied from interface:TagReader
Reads astring
value.- Specified by:
readString
in interfaceTagReader
- Throws:
IOException
-
readByteArray
Description copied from interface:TagReader
Reads abytes
value as a byte array.- Specified by:
readByteArray
in interfaceTagReader
- Throws:
IOException
-
readByteBuffer
Description copied from interface:TagReader
Reads abytes
value as a ByteBuffer.- Specified by:
readByteBuffer
in interfaceTagReader
- Throws:
IOException
-
readUInt32
- Specified by:
readUInt32
in interfaceTagReader
- Throws:
IOException
-
readEnum
- Specified by:
readEnum
in interfaceTagReader
- Throws:
IOException
-
readSFixed32
- Specified by:
readSFixed32
in interfaceTagReader
- Throws:
IOException
-
readSFixed64
- Specified by:
readSFixed64
in interfaceTagReader
- Throws:
IOException
-
readSInt32
- Specified by:
readSInt32
in interfaceTagReader
- Throws:
IOException
-
readSInt64
- Specified by:
readSInt64
in interfaceTagReader
- Throws:
IOException
-
pushLimit
Description copied from interface:TagReader
Sets a limit (based on the length of the length delimited value) when entering an embedded message.- Specified by:
pushLimit
in interfaceTagReader
- Returns:
- the previous limit.
- Throws:
IOException
-
popLimit
public void popLimit(int oldLimit) Description copied from interface:TagReader
Returns back to a previous limit returned by pushLimit. -
getSerializationContext
Description copied from interface:ProtobufTagMarshaller.OperationContext
Provides access to theImmutableSerializationContext
.- Specified by:
getSerializationContext
in interfaceProtobufTagMarshaller.OperationContext
-
getParam
- Specified by:
getParam
in interfaceProtobufTagMarshaller.OperationContext
-
setParam
- Specified by:
setParam
in interfaceProtobufTagMarshaller.OperationContext
-
getReader
- Specified by:
getReader
in interfaceProtobufTagMarshaller.ReadContext
-
fullBufferArray
Description copied from interface:TagReader
Returns the full buffer array allowing an alternative protobuf parser to be used in marshallers, and at the root message level. This should not be mixed with the other tag reader read***() methods, or else an IllegalStateException will be thrown. Therefore you cannot mix protostream annotated models with other parsers reading the raw payload array.- Specified by:
fullBufferArray
in interfaceTagReader
- Throws:
IOException
-
fullBufferInputStream
Description copied from interface:TagReader
Returns the input stream allowing an alternative protobuf parser to be used in marshallers, and at the root message level. This should not be mixed with the other tag reader read***() methods, or else an IllegalStateException will be thrown. Therefore you cannot mix protostream annotated models with other parsers reading the raw payload input stream.- Specified by:
fullBufferInputStream
in interfaceTagReader
- Throws:
IOException
-
isInputStream
public boolean isInputStream()- Specified by:
isInputStream
in interfaceTagReader
- Returns:
- Returns true if the original payload is InputStream based.
-
getProtoStreamReader
public org.infinispan.protostream.impl.ProtoStreamReaderImpl getProtoStreamReader()
-