spring-framework / org.springframework.core.codec

Package org.springframework.core.codec

Types

AbstractSingleValueEncoder

abstract class AbstractSingleValueEncoder<T : Any> : AbstractEncoder<T>

Abstract base class for org.springframework.core.codec.Encoder classes that can only deal with a single value.

ByteArrayDecoder

open class ByteArrayDecoder : AbstractDecoder<ByteArray>

Decoder for byte arrays.

ByteArrayEncoder

open class ByteArrayEncoder : AbstractEncoder<ByteArray>

Encoder for byte arrays.

ByteBufferDecoder

open class ByteBufferDecoder : AbstractDecoder<ByteBuffer>

Decoder for ByteBuffers.

ByteBufferEncoder

open class ByteBufferEncoder : AbstractEncoder<ByteBuffer>

Encoder for ByteBuffers.

CharSequenceEncoder

open class CharSequenceEncoder : AbstractEncoder<CharSequence>

Encode from a CharSequence stream to a bytes stream.

DataBufferDecoder

open class DataBufferDecoder : AbstractDecoder<DataBuffer>

Simple pass-through decoder for DataBuffers.

Note that the "decoded" buffers returned by instances of this class should be released after usage by calling org.springframework.core.io.buffer.DataBufferUtils#release(DataBuffer).

DataBufferEncoder

open class DataBufferEncoder : AbstractEncoder<DataBuffer>

Simple pass-through encoder for DataBuffers.

ResourceDecoder

open class ResourceDecoder : AbstractDecoder<Resource>

Decoder for Resources.

ResourceEncoder

open class ResourceEncoder : AbstractSingleValueEncoder<Resource>

Encoder for Resources.

ResourceRegionEncoder

open class ResourceRegionEncoder : AbstractEncoder<ResourceRegion>

Encoder for ResourceRegions.

StringDecoder

open class StringDecoder : AbstractDecoder<String>

Decode from a bytes stream to a String stream.

By default, this decoder will split the received DataBuffers along newline characters (\r\n), but this can be changed by passing false as a constructor argument.

Exceptions

CodecException

open class CodecException : NestedRuntimeException

General error that indicates a problem while encoding and decoding to and from an Object stream.

DecodingException

open class DecodingException : CodecException

Indicates an issue with decoding the input stream with a focus on content related issues such as a parse failure. As opposed to more general I/O errors, illegal state, or a CodecException such as a configuration issue that a Decoder may choose to raise.

For example in server web application, a DecodingException would translate to a response with a 400 (bad input) status while CodecException would translate to 500 (server error) status.

EncodingException

open class EncodingException : CodecException

Indicates an issue with encoding the input Object stream with a focus on not being able to encode Objects. As opposed to a more general I/O errors or a CodecException such as a configuration issue that an Encoder may also choose to raise.