Class AbstractSymbolTypeDecoder
- java.lang.Object
-
- org.apache.qpid.protonj2.codec.decoders.AbstractPrimitiveTypeDecoder<Symbol>
-
- org.apache.qpid.protonj2.codec.decoders.primitives.AbstractSymbolTypeDecoder
-
- All Implemented Interfaces:
SymbolTypeDecoder,PrimitiveTypeDecoder<Symbol>,StreamTypeDecoder<Symbol>,TypeDecoder<Symbol>
- Direct Known Subclasses:
Symbol32TypeDecoder,Symbol8TypeDecoder
public abstract class AbstractSymbolTypeDecoder extends AbstractPrimitiveTypeDecoder<Symbol> implements SymbolTypeDecoder
Base class for the Symbol decoders used on AMQP Symbol types.
-
-
Constructor Summary
Constructors Constructor Description AbstractSymbolTypeDecoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract intreadSize(InputStream stream)Subclasses must read the correct number of bytes from the buffer to determine the size of the encoded Symbol value.protected abstract intreadSize(ProtonBuffer buffer)Subclasses must read the correct number of bytes from the buffer to determine the size of the encoded Symbol value.StringreadString(InputStream stream, StreamDecoderState state)Reads a String view of an encoded Symbol value from the given buffer.StringreadString(ProtonBuffer buffer, DecoderState state)Reads a String view of an encoded Symbol value from the given buffer.SymbolreadValue(InputStream stream, StreamDecoderState state)Reads the next type from the given buffer and returns it.SymbolreadValue(ProtonBuffer buffer, DecoderState state)Reads the next type from the given buffer and returns it.voidskipValue(InputStream stream, StreamDecoderState state)Skips over the bytes that compose the type this descriptor decodes.voidskipValue(ProtonBuffer buffer, DecoderState state)Skips over the bytes that compose the type this descriptor decodes.-
Methods inherited from class org.apache.qpid.protonj2.codec.decoders.AbstractPrimitiveTypeDecoder
isArrayType, isJavaPrimitive, readArrayElements, readArrayElements
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.protonj2.codec.decoders.PrimitiveTypeDecoder
getTypeCode, isJavaPrimitive
-
Methods inherited from interface org.apache.qpid.protonj2.codec.StreamTypeDecoder
getTypeClass, isArrayType, readArrayElements
-
Methods inherited from interface org.apache.qpid.protonj2.codec.decoders.primitives.SymbolTypeDecoder
getTypeClass
-
Methods inherited from interface org.apache.qpid.protonj2.codec.TypeDecoder
isArrayType, readArrayElements
-
-
-
-
Method Detail
-
readValue
public Symbol readValue(ProtonBuffer buffer, DecoderState state) throws DecodeException
Description copied from interface:TypeDecoderReads the next type from the given buffer and returns it.- Specified by:
readValuein interfaceTypeDecoder<Symbol>- Parameters:
buffer- the source of encoded data.state- the current state of the decoder.- Returns:
- the next instance in the stream that this decoder handles.
- Throws:
DecodeException- if an error is encountered while reading the next value.
-
readString
public String readString(ProtonBuffer buffer, DecoderState state) throws DecodeException
Reads a String view of an encoded Symbol value from the given buffer.This method has the same result as calling the Symbol reading variant
readValue(ProtonBuffer, DecoderState)and then invoking the toString method on the resulting Symbol.- Parameters:
buffer- The buffer to read the encoded symbol from.state- The encoder state that applied to this decode operation.- Returns:
- a String view of the encoded Symbol value.
- Throws:
DecodeException- if an error occurs decoding the Symbol from the given buffer.
-
readValue
public Symbol readValue(InputStream stream, StreamDecoderState state) throws DecodeException
Description copied from interface:StreamTypeDecoderReads the next type from the given buffer and returns it.- Specified by:
readValuein interfaceStreamTypeDecoder<Symbol>- Parameters:
stream- the source of encoded data.state- the current state of the decoder.- Returns:
- the next instance in the stream that this decoder handles.
- Throws:
DecodeException- if an error is encountered while reading the next value.
-
readString
public String readString(InputStream stream, StreamDecoderState state) throws DecodeException
Reads a String view of an encoded Symbol value from the given buffer.This method has the same result as calling the Symbol reading variant
readValue(ProtonBuffer, DecoderState)and then invoking the toString method on the resulting Symbol.- Parameters:
stream- The InputStream to read the encoded symbol from.state- The encoder state that applied to this decode operation.- Returns:
- a String view of the encoded Symbol value.
- Throws:
DecodeException- if an error occurs decoding the Symbol from the given buffer.
-
skipValue
public void skipValue(ProtonBuffer buffer, DecoderState state) throws DecodeException
Description copied from interface:TypeDecoderSkips over the bytes that compose the type this descriptor decodes.Skipping values can be used when the type is not used or processed by the application doing the decoding. An example might be an AMQP message decoder that only needs to decode certain parts of the message and not others.
- Specified by:
skipValuein interfaceTypeDecoder<Symbol>- Parameters:
buffer- The buffer that contains the encoded type.state- The decoder state.- Throws:
DecodeException- if an error occurs while skipping the value.
-
skipValue
public void skipValue(InputStream stream, StreamDecoderState state) throws DecodeException
Description copied from interface:StreamTypeDecoderSkips over the bytes that compose the type this descriptor decodes.Skipping values can be used when the type is not used or processed by the application doing the decoding. An example might be an AMQP message decoder that only needs to decode certain parts of the message and not others.
- Specified by:
skipValuein interfaceStreamTypeDecoder<Symbol>- Parameters:
stream- The stream that contains the encoded type.state- The decoder state.- Throws:
DecodeException- if an error occurs while skipping the value.
-
readSize
protected abstract int readSize(ProtonBuffer buffer) throws DecodeException
Subclasses must read the correct number of bytes from the buffer to determine the size of the encoded Symbol value.- Parameters:
buffer- The buffer to read the size from.- Returns:
- the number of bytes that make up the encoded Symbol value.
- Throws:
DecodeException- if an error occurs reading the size value.
-
readSize
protected abstract int readSize(InputStream stream) throws DecodeException
Subclasses must read the correct number of bytes from the buffer to determine the size of the encoded Symbol value.- Parameters:
stream- The InputStream to read the size from.- Returns:
- the number of bytes that make up the encoded Symbol value.
- Throws:
DecodeException- if an error occurs reading the size value.
-
-