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:
- anistor@redhat.com
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcheckLastTagWas(int tag)Checks that the previously read tag is the last tag of a message or group.byte[]fullBufferArray()Returns the full buffer array allowing an alternative protobuf parser to be used in marshallers, and at the root message level.InputStreamfullBufferInputStream()Returns the input stream allowing an alternative protobuf parser to be used in marshallers, and at the root message level.ObjectgetParam(Object key)org.infinispan.protostream.impl.ProtoStreamReaderImplgetProtoStreamReader()Deprecated.this will be removed in 5.0 together withMessageMarshallerTagReadergetReader()SerializationContextImplgetSerializationContext()Provides access to theImmutableSerializationContext.booleanisAtEnd()Returns true if we have reached the end of input or the limit set with pushLimit.booleanisInputStream()static TagReaderImplnewInstance(ImmutableSerializationContext serCtx, byte[] buf)static TagReaderImplnewInstance(ImmutableSerializationContext serCtx, byte[] buf, int offset, int length)static TagReaderImplnewInstance(ImmutableSerializationContext serCtx, InputStream input)static TagReaderImplnewInstance(ImmutableSerializationContext serCtx, ByteBuffer buf)static TagReaderImplnewNestedInstance(ProtobufTagMarshaller.ReadContext parent, byte[] buf)static TagReaderImplnewNestedInstance(ProtobufTagMarshaller.ReadContext parent, InputStream input)voidpopLimit(int oldLimit)Returns back to a previous limit returned by pushLimit.intpushLimit(int limit)Sets a limit (based on the length of the length delimited value) when entering an embedded message.booleanreadBool()Read aboolvalue from the stream.byte[]readByteArray()Reads abytesvalue as a byte array.ByteBufferreadByteBuffer()Reads abytesvalue as a ByteBuffer.doublereadDouble()Read adoublevalue from the stream.intreadEnum()Reads an enum value from the stream as an integer value.intreadFixed32()Read afixed32value from the stream.longreadFixed64()Read afixed64value from the stream.floatreadFloat()Read afloatvalue from the stream.intreadInt32()Read aint32value from the stream.longreadInt64()Read aint64value from the stream.intreadSFixed32()Read asfixed32value from the stream.longreadSFixed64()Read asfixed64value from the stream.intreadSInt32()Read asint32value from the stream.longreadSInt64()Read asint64value from the stream.StringreadString()Reads astringvalue.intreadTag()Reads a tag and returns it or returns 0 in case the input data is finished.intreadUInt32()Read auint32value from the stream.longreadUInt64()Read auint64value from the stream.voidsetParam(Object key, Object value)booleanskipField(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 IOExceptionDescription copied from interface:TagReaderReturns true if we have reached the end of input or the limit set with pushLimit.- Specified by:
isAtEndin interfaceTagReader- Throws:
IOException
-
readTag
public int readTag() throws IOExceptionDescription copied from interface:TagReaderReads a tag and returns it or returns 0 in case the input data is finished.- Specified by:
readTagin interfaceRawProtoStreamReader- Specified by:
readTagin interfaceTagReader- Throws:
IOException
-
checkLastTagWas
public void checkLastTagWas(int tag) throws IOExceptionDescription copied from interface:TagReaderChecks 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:
checkLastTagWasin interfaceRawProtoStreamReader- Specified by:
checkLastTagWasin interfaceTagReader- Throws:
IOException
-
skipField
public boolean skipField(int tag) throws IOExceptionDescription copied from interface:TagReaderSkips a tag+value pair and returns true for normal tags but if the tag is an end group tag it returns false.- Specified by:
skipFieldin interfaceRawProtoStreamReader- Specified by:
skipFieldin interfaceTagReader- Throws:
IOException
-
readUInt64
public long readUInt64() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead auint64value from the stream.- Specified by:
readUInt64in interfaceRawProtoStreamReader- Specified by:
readUInt64in interfaceTagReader- Throws:
IOException
-
readInt64
public long readInt64() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead aint64value from the stream.- Specified by:
readInt64in interfaceRawProtoStreamReader- Specified by:
readInt64in interfaceTagReader- Throws:
IOException
-
readInt32
public int readInt32() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead aint32value from the stream.- Specified by:
readInt32in interfaceRawProtoStreamReader- Specified by:
readInt32in interfaceTagReader- Throws:
IOException
-
readFixed64
public long readFixed64() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead afixed64value from the stream.- Specified by:
readFixed64in interfaceRawProtoStreamReader- Specified by:
readFixed64in interfaceTagReader- Throws:
IOException
-
readFixed32
public int readFixed32() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead afixed32value from the stream.- Specified by:
readFixed32in interfaceRawProtoStreamReader- Specified by:
readFixed32in interfaceTagReader- Throws:
IOException
-
readDouble
public double readDouble() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead adoublevalue from the stream.- Specified by:
readDoublein interfaceRawProtoStreamReader- Specified by:
readDoublein interfaceTagReader- Throws:
IOException
-
readFloat
public float readFloat() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead afloatvalue from the stream.- Specified by:
readFloatin interfaceRawProtoStreamReader- Specified by:
readFloatin interfaceTagReader- Throws:
IOException
-
readBool
public boolean readBool() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead aboolvalue from the stream.- Specified by:
readBoolin interfaceRawProtoStreamReader- Specified by:
readBoolin interfaceTagReader- Throws:
IOException
-
readString
public String readString() throws IOException
Description copied from interface:TagReaderReads astringvalue.- Specified by:
readStringin interfaceRawProtoStreamReader- Specified by:
readStringin interfaceTagReader- Throws:
IOException
-
readByteArray
public byte[] readByteArray() throws IOExceptionDescription copied from interface:TagReaderReads abytesvalue as a byte array.- Specified by:
readByteArrayin interfaceRawProtoStreamReader- Specified by:
readByteArrayin interfaceTagReader- Throws:
IOException
-
readByteBuffer
public ByteBuffer readByteBuffer() throws IOException
Description copied from interface:TagReaderReads abytesvalue as a ByteBuffer.- Specified by:
readByteBufferin interfaceRawProtoStreamReader- Specified by:
readByteBufferin interfaceTagReader- Throws:
IOException
-
readUInt32
public int readUInt32() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead auint32value from the stream.- Specified by:
readUInt32in interfaceRawProtoStreamReader- Specified by:
readUInt32in interfaceTagReader- Throws:
IOException
-
readEnum
public int readEnum() throws IOExceptionDescription copied from interface:RawProtoStreamReaderReads an enum value from the stream as an integer value.- Specified by:
readEnumin interfaceRawProtoStreamReader- Specified by:
readEnumin interfaceTagReader- Throws:
IOException
-
readSFixed32
public int readSFixed32() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead asfixed32value from the stream.- Specified by:
readSFixed32in interfaceRawProtoStreamReader- Specified by:
readSFixed32in interfaceTagReader- Throws:
IOException
-
readSFixed64
public long readSFixed64() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead asfixed64value from the stream.- Specified by:
readSFixed64in interfaceRawProtoStreamReader- Specified by:
readSFixed64in interfaceTagReader- Throws:
IOException
-
readSInt32
public int readSInt32() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead asint32value from the stream.- Specified by:
readSInt32in interfaceRawProtoStreamReader- Specified by:
readSInt32in interfaceTagReader- Throws:
IOException
-
readSInt64
public long readSInt64() throws IOExceptionDescription copied from interface:RawProtoStreamReaderRead asint64value from the stream.- Specified by:
readSInt64in interfaceRawProtoStreamReader- Specified by:
readSInt64in interfaceTagReader- Throws:
IOException
-
pushLimit
public int pushLimit(int limit) throws IOExceptionDescription copied from interface:TagReaderSets a limit (based on the length of the length delimited value) when entering an embedded message.- Specified by:
pushLimitin interfaceRawProtoStreamReader- Specified by:
pushLimitin interfaceTagReader- Returns:
- the previous limit.
- Throws:
IOException
-
popLimit
public void popLimit(int oldLimit)
Description copied from interface:TagReaderReturns back to a previous limit returned by pushLimit.- Specified by:
popLimitin interfaceRawProtoStreamReader- Specified by:
popLimitin interfaceTagReader
-
getSerializationContext
public SerializationContextImpl getSerializationContext()
Description copied from interface:ProtobufTagMarshaller.OperationContextProvides access to theImmutableSerializationContext.- Specified by:
getSerializationContextin interfaceProtobufTagMarshaller.OperationContext
-
getParam
public Object getParam(Object key)
- Specified by:
getParamin interfaceProtobufTagMarshaller.OperationContext
-
setParam
public void setParam(Object key, Object value)
- Specified by:
setParamin interfaceProtobufTagMarshaller.OperationContext
-
getReader
public TagReader getReader()
- Specified by:
getReaderin interfaceProtobufTagMarshaller.ReadContext
-
fullBufferArray
public byte[] fullBufferArray() throws IOExceptionDescription copied from interface:TagReaderReturns 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:
fullBufferArrayin interfaceTagReader- Throws:
IOException
-
fullBufferInputStream
public InputStream fullBufferInputStream() throws IOException
Description copied from interface:TagReaderReturns 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:
fullBufferInputStreamin interfaceTagReader- Throws:
IOException
-
isInputStream
public boolean isInputStream()
- Specified by:
isInputStreamin interfaceTagReader- Returns:
- Returns true if the original payload is InputStream based.
-
getProtoStreamReader
@Deprecated public org.infinispan.protostream.impl.ProtoStreamReaderImpl getProtoStreamReader()
Deprecated.this will be removed in 5.0 together withMessageMarshaller
-
-