Package org.infinispan.protostream.impl
Class TagReaderImpl
- java.lang.Object
-
- org.infinispan.protostream.impl.TagReaderImpl
-
- All Implemented Interfaces:
ProtobufTagMarshaller.OperationContext
,ProtobufTagMarshaller.ReadContext
,RawProtoStreamReader
,TagReader
public final class TagReaderImpl extends Object implements TagReader, ProtobufTagMarshaller.ReadContext
- Since:
- 3.0
- Author:
- [email protected]
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkLastTagWas(int tag)
Checks that the previously read tag is the last tag of a message or group.Object
getParam(Object key)
org.infinispan.protostream.impl.ProtoStreamReaderImpl
getProtoStreamReader()
Deprecated.this will be removed in 5.0 together withMessageMarshaller
TagReader
getReader()
SerializationContextImpl
getSerializationContext()
Provides access to theImmutableSerializationContext
.boolean
isAtEnd()
Returns true if we have reached the end of input or the limit set with pushLimit.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()
Read abool
value from the stream.byte[]
readByteArray()
Reads abytes
value as a byte array.ByteBuffer
readByteBuffer()
Reads abytes
value as a ByteBuffer.double
readDouble()
Read adouble
value from the stream.int
readEnum()
Reads an enum value from the stream as an integer value.int
readFixed32()
Read afixed32
value from the stream.long
readFixed64()
Read afixed64
value from the stream.float
readFloat()
Read afloat
value from the stream.int
readInt32()
Read aint32
value from the stream.long
readInt64()
Read aint64
value from the stream.int
readSFixed32()
Read asfixed32
value from the stream.long
readSFixed64()
Read asfixed64
value from the stream.int
readSInt32()
Read asint32
value from the stream.long
readSInt64()
Read asint64
value from the stream.String
readString()
Reads astring
value.int
readTag()
Reads a tag and returns it or returns 0 in case the input data is finished.int
readUInt32()
Read auint32
value from the stream.long
readUInt64()
Read auint64
value from the stream.void
setParam(Object key, Object value)
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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.protostream.RawProtoStreamReader
readRawVarint32, readRawVarint64
-
-
-
-
Method Detail
-
newNestedInstance
public static TagReaderImpl newNestedInstance(ProtobufTagMarshaller.ReadContext parent, InputStream input)
-
newNestedInstance
public static TagReaderImpl newNestedInstance(ProtobufTagMarshaller.ReadContext parent, byte[] buf)
-
newInstance
public static TagReaderImpl newInstance(ImmutableSerializationContext serCtx, InputStream input)
-
newInstance
public static TagReaderImpl newInstance(ImmutableSerializationContext serCtx, ByteBuffer buf)
-
newInstance
public static TagReaderImpl newInstance(ImmutableSerializationContext serCtx, byte[] buf)
-
newInstance
public static TagReaderImpl newInstance(ImmutableSerializationContext serCtx, byte[] buf, int offset, int length)
-
isAtEnd
public boolean isAtEnd() throws IOException
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
public int readTag() throws IOException
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 interfaceRawProtoStreamReader
- Specified by:
readTag
in interfaceTagReader
- Throws:
IOException
-
checkLastTagWas
public void checkLastTagWas(int tag) throws IOException
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 interfaceRawProtoStreamReader
- Specified by:
checkLastTagWas
in interfaceTagReader
- Throws:
IOException
-
skipField
public boolean skipField(int tag) throws IOException
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 interfaceRawProtoStreamReader
- Specified by:
skipField
in interfaceTagReader
- Throws:
IOException
-
readUInt64
public long readUInt64() throws IOException
Description copied from interface:RawProtoStreamReader
Read auint64
value from the stream.- Specified by:
readUInt64
in interfaceRawProtoStreamReader
- Specified by:
readUInt64
in interfaceTagReader
- Throws:
IOException
-
readInt64
public long readInt64() throws IOException
Description copied from interface:RawProtoStreamReader
Read aint64
value from the stream.- Specified by:
readInt64
in interfaceRawProtoStreamReader
- Specified by:
readInt64
in interfaceTagReader
- Throws:
IOException
-
readInt32
public int readInt32() throws IOException
Description copied from interface:RawProtoStreamReader
Read aint32
value from the stream.- Specified by:
readInt32
in interfaceRawProtoStreamReader
- Specified by:
readInt32
in interfaceTagReader
- Throws:
IOException
-
readFixed64
public long readFixed64() throws IOException
Description copied from interface:RawProtoStreamReader
Read afixed64
value from the stream.- Specified by:
readFixed64
in interfaceRawProtoStreamReader
- Specified by:
readFixed64
in interfaceTagReader
- Throws:
IOException
-
readFixed32
public int readFixed32() throws IOException
Description copied from interface:RawProtoStreamReader
Read afixed32
value from the stream.- Specified by:
readFixed32
in interfaceRawProtoStreamReader
- Specified by:
readFixed32
in interfaceTagReader
- Throws:
IOException
-
readDouble
public double readDouble() throws IOException
Description copied from interface:RawProtoStreamReader
Read adouble
value from the stream.- Specified by:
readDouble
in interfaceRawProtoStreamReader
- Specified by:
readDouble
in interfaceTagReader
- Throws:
IOException
-
readFloat
public float readFloat() throws IOException
Description copied from interface:RawProtoStreamReader
Read afloat
value from the stream.- Specified by:
readFloat
in interfaceRawProtoStreamReader
- Specified by:
readFloat
in interfaceTagReader
- Throws:
IOException
-
readBool
public boolean readBool() throws IOException
Description copied from interface:RawProtoStreamReader
Read abool
value from the stream.- Specified by:
readBool
in interfaceRawProtoStreamReader
- Specified by:
readBool
in interfaceTagReader
- Throws:
IOException
-
readString
public String readString() throws IOException
Description copied from interface:TagReader
Reads astring
value.- Specified by:
readString
in interfaceRawProtoStreamReader
- Specified by:
readString
in interfaceTagReader
- Throws:
IOException
-
readByteArray
public byte[] readByteArray() throws IOException
Description copied from interface:TagReader
Reads abytes
value as a byte array.- Specified by:
readByteArray
in interfaceRawProtoStreamReader
- Specified by:
readByteArray
in interfaceTagReader
- Throws:
IOException
-
readByteBuffer
public ByteBuffer readByteBuffer() throws IOException
Description copied from interface:TagReader
Reads abytes
value as a ByteBuffer.- Specified by:
readByteBuffer
in interfaceRawProtoStreamReader
- Specified by:
readByteBuffer
in interfaceTagReader
- Throws:
IOException
-
readUInt32
public int readUInt32() throws IOException
Description copied from interface:RawProtoStreamReader
Read auint32
value from the stream.- Specified by:
readUInt32
in interfaceRawProtoStreamReader
- Specified by:
readUInt32
in interfaceTagReader
- Throws:
IOException
-
readEnum
public int readEnum() throws IOException
Description copied from interface:RawProtoStreamReader
Reads an enum value from the stream as an integer value.- Specified by:
readEnum
in interfaceRawProtoStreamReader
- Specified by:
readEnum
in interfaceTagReader
- Throws:
IOException
-
readSFixed32
public int readSFixed32() throws IOException
Description copied from interface:RawProtoStreamReader
Read asfixed32
value from the stream.- Specified by:
readSFixed32
in interfaceRawProtoStreamReader
- Specified by:
readSFixed32
in interfaceTagReader
- Throws:
IOException
-
readSFixed64
public long readSFixed64() throws IOException
Description copied from interface:RawProtoStreamReader
Read asfixed64
value from the stream.- Specified by:
readSFixed64
in interfaceRawProtoStreamReader
- Specified by:
readSFixed64
in interfaceTagReader
- Throws:
IOException
-
readSInt32
public int readSInt32() throws IOException
Description copied from interface:RawProtoStreamReader
Read asint32
value from the stream.- Specified by:
readSInt32
in interfaceRawProtoStreamReader
- Specified by:
readSInt32
in interfaceTagReader
- Throws:
IOException
-
readSInt64
public long readSInt64() throws IOException
Description copied from interface:RawProtoStreamReader
Read asint64
value from the stream.- Specified by:
readSInt64
in interfaceRawProtoStreamReader
- Specified by:
readSInt64
in interfaceTagReader
- Throws:
IOException
-
pushLimit
public int pushLimit(int limit) throws IOException
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 interfaceRawProtoStreamReader
- 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.- Specified by:
popLimit
in interfaceRawProtoStreamReader
- Specified by:
popLimit
in interfaceTagReader
-
getSerializationContext
public SerializationContextImpl getSerializationContext()
Description copied from interface:ProtobufTagMarshaller.OperationContext
Provides access to theImmutableSerializationContext
.- Specified by:
getSerializationContext
in interfaceProtobufTagMarshaller.OperationContext
-
getParam
public Object getParam(Object key)
- Specified by:
getParam
in interfaceProtobufTagMarshaller.OperationContext
-
setParam
public void setParam(Object key, Object value)
- Specified by:
setParam
in interfaceProtobufTagMarshaller.OperationContext
-
getReader
public TagReader getReader()
- Specified by:
getReader
in interfaceProtobufTagMarshaller.ReadContext
-
getProtoStreamReader
@Deprecated public org.infinispan.protostream.impl.ProtoStreamReaderImpl getProtoStreamReader()
Deprecated.this will be removed in 5.0 together withMessageMarshaller
-
-