Package org.springframework.http.codec.xml

# Class Jaxb2XmlDecoder

java.lang.Object
org.springframework.core.codec.AbstractDecoder<Object>
org.springframework.http.codec.xml.Jaxb2XmlDecoder

All Implemented Interfaces:
  `org.springframework.core.codec.Decoder<Object>`

public class Jaxb2XmlDecoder extends org.springframework.core.codec.AbstractDecoder<Object>
Decode from a bytes stream containing XML elements to a stream of `Object`s (POJOs).

Since:
  5.0
Author:
  Sebastien Deleuze, Arjen Poutsma
See Also:
  - `Jaxb2XmlEncoder`

## Field Summary

### Fields inherited from class org.springframework.core.codec.AbstractDecoder

`logger`

## Constructor Summary

Constructors
Constructor
Description
`Jaxb2XmlDecoder()`
`Jaxb2XmlDecoder(org.springframework.util.MimeType... supportedMimeTypes)`
Create a `Jaxb2XmlDecoder` with the specified MIME types.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canDecode(org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType)`
`reactor.core.publisher.Flux<Object>`
`decode(Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`Object`
`decode(org.springframework.core.io.buffer.DataBuffer dataBuffer, org.springframework.core.ResolvableType targetType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Object>`
`decodeToMono(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`int`
`getMaxInMemorySize()`
Return the `configured` byte count limit.
`Function<Unmarshaller,Unmarshaller>`
`getUnmarshallerProcessor()`
Return the configured processor for customizing Unmarshaller instances.
`void`
`setMaxInMemorySize(int byteCount)`
Set the max number of bytes that can be buffered by this decoder.
`void`
`setUnmarshallerProcessor(Function<Unmarshaller,Unmarshaller> processor)`
Configure a processor function to customize Unmarshaller instances.

### Methods inherited from class org.springframework.core.codec.AbstractDecoder

`getDecodableMimeTypes, getLogger, setLogger`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.core.codec.Decoder

`getDecodableMimeTypes`

## Constructor Details

### Jaxb2XmlDecoder

public Jaxb2XmlDecoder()

### Jaxb2XmlDecoder

public Jaxb2XmlDecoder(org.springframework.util.MimeType... supportedMimeTypes)
Create a `Jaxb2XmlDecoder` with the specified MIME types.

Parameters:
  `supportedMimeTypes` - supported MIME types
Since:
  5.1.9

## Method Details

### setUnmarshallerProcessor

public void setUnmarshallerProcessor(Function<Unmarshaller,Unmarshaller> processor)
Configure a processor function to customize Unmarshaller instances.

Parameters:
  `processor` - the function to use
Since:
  5.1.3

### getUnmarshallerProcessor

public Function<Unmarshaller,Unmarshaller> getUnmarshallerProcessor()
Return the configured processor for customizing Unmarshaller instances.

Since:
  5.1.3

### setMaxInMemorySize

public void setMaxInMemorySize(int byteCount)
Set the max number of bytes that can be buffered by this decoder. This is either the size of the entire input when decoding as a whole, or when using async parsing with Aalto XML, it is the size of one top-level XML tree. When the limit is exceeded, `DataBufferLimitException` is raised.

By default this is set to 256K.

Parameters:
  `byteCount` - the max number of bytes to buffer, or -1 for unlimited
Since:
  5.1.11

### getMaxInMemorySize

public int getMaxInMemorySize()
Return the `configured` byte count limit.

Since:
  5.1.11

### canDecode

public boolean canDecode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)

Specified by:
  `canDecode` in interface `org.springframework.core.codec.Decoder<Object>`
Overrides:
  `canDecode` in class `org.springframework.core.codec.AbstractDecoder<Object>`

### decode

public reactor.core.publisher.Flux<Object> decode(Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)

### decodeToMono

public reactor.core.publisher.Mono<Object> decodeToMono(Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)

Specified by:
  `decodeToMono` in interface `org.springframework.core.codec.Decoder<Object>`
Overrides:
  `decodeToMono` in class `org.springframework.core.codec.AbstractDecoder<Object>`

### decode

@NonNull public Object decode(org.springframework.core.io.buffer.DataBuffer dataBuffer, org.springframework.core.ResolvableType targetType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints) throws org.springframework.core.codec.DecodingException

Throws:
  `org.springframework.core.codec.DecodingException`