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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final classprivate static classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TagReaderImpl.Decoderprivate static final byte[]private static final ByteBufferprivate static final Logprivate final TagReaderImplprivate ProtoStreamReaderImplDeprecated.private final SerializationContextImplprivate static final Charset -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTagReaderImpl(SerializationContextImpl serCtx, TagReaderImpl.Decoder decoder) privateTagReaderImpl(TagReaderImpl parent, TagReaderImpl.Decoder decoder) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckBufferUnused(String methodName) voidcheckLastTagWas(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.Provides access to theImmutableSerializationContext.booleanisAtEnd()Returns true if we have reached the end of input or the limit set with pushLimit.booleanstatic 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()byte[]Reads abytesvalue as a byte array.Reads abytesvalue as a ByteBuffer.doubleintreadEnum()intlongfloatintlongintlongintlongReads astringvalue.intreadTag()Reads a tag and returns it or returns 0 in case the input data is finished.intlongvoidbooleanskipField(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.
-
Field Details
-
log
-
UTF8
-
EMPTY
private static final byte[] EMPTY -
EMPTY_BUFFER
-
serCtx
-
decoder
-
parent
-
params
-
reader
Deprecated.
-
-
Constructor Details
-
TagReaderImpl
-
TagReaderImpl
-
-
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:TagReaderReturns true if we have reached the end of input or the limit set with pushLimit.- Specified by:
isAtEndin interfaceTagReader- Throws:
IOException
-
readTag
Description copied from interface:TagReaderReads a tag and returns it or returns 0 in case the input data is finished.- Specified by:
readTagin interfaceTagReader- Throws:
IOException
-
checkLastTagWas
Description 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 interfaceTagReader- Throws:
IOException
-
skipField
Description 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 interfaceTagReader- Throws:
IOException
-
readUInt64
- Specified by:
readUInt64in interfaceTagReader- Throws:
IOException
-
readInt64
- Specified by:
readInt64in interfaceTagReader- Throws:
IOException
-
readInt32
- Specified by:
readInt32in interfaceTagReader- Throws:
IOException
-
readFixed64
- Specified by:
readFixed64in interfaceTagReader- Throws:
IOException
-
readFixed32
- Specified by:
readFixed32in interfaceTagReader- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceTagReader- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceTagReader- Throws:
IOException
-
readBool
- Specified by:
readBoolin interfaceTagReader- Throws:
IOException
-
readString
Description copied from interface:TagReaderReads astringvalue.- Specified by:
readStringin interfaceTagReader- Throws:
IOException
-
readByteArray
Description copied from interface:TagReaderReads abytesvalue as a byte array.- Specified by:
readByteArrayin interfaceTagReader- Throws:
IOException
-
readByteBuffer
Description copied from interface:TagReaderReads abytesvalue as a ByteBuffer.- Specified by:
readByteBufferin interfaceTagReader- Throws:
IOException
-
readUInt32
- Specified by:
readUInt32in interfaceTagReader- Throws:
IOException
-
readEnum
- Specified by:
readEnumin interfaceTagReader- Throws:
IOException
-
readSFixed32
- Specified by:
readSFixed32in interfaceTagReader- Throws:
IOException
-
readSFixed64
- Specified by:
readSFixed64in interfaceTagReader- Throws:
IOException
-
readSInt32
- Specified by:
readSInt32in interfaceTagReader- Throws:
IOException
-
readSInt64
- Specified by:
readSInt64in interfaceTagReader- Throws:
IOException
-
pushLimit
Description copied from interface:TagReaderSets a limit (based on the length of the length delimited value) when entering an embedded message.- 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. -
getSerializationContext
Description copied from interface:ProtobufTagMarshaller.OperationContextProvides access to theImmutableSerializationContext.- Specified by:
getSerializationContextin interfaceProtobufTagMarshaller.OperationContext
-
getParam
- Specified by:
getParamin interfaceProtobufTagMarshaller.OperationContext
-
setParam
- Specified by:
setParamin interfaceProtobufTagMarshaller.OperationContext
-
getReader
- Specified by:
getReaderin interfaceProtobufTagMarshaller.ReadContext
-
fullBufferArray
Description 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
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
-
checkBufferUnused
-
isInputStream
public boolean isInputStream()- Specified by:
isInputStreamin interfaceTagReader- Returns:
- Returns true if the original payload is InputStream based.
-
getProtoStreamReader
-