Package org.springframework.http.codec

# Class KotlinSerializationStringEncoder<T extends kotlinx.serialization.StringFormat>

java.lang.Object
org.springframework.http.codec.KotlinSerializationSupport<T>
org.springframework.http.codec.KotlinSerializationStringEncoder<T>

Type Parameters:
  `T` - the type of `StringFormat`

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

Direct Known Subclasses:
  `KotlinSerializationJsonEncoder`

public abstract class KotlinSerializationStringEncoder<T extends kotlinx.serialization.StringFormat> extends KotlinSerializationSupport<T> implements org.springframework.core.codec.Encoder<Object>
Abstract base class for `Encoder` implementations that defer to Kotlin string serializers.

Since:
  6.0
Author:
  Sebastien Deleuze, Iain Henderson, Arjen Poutsma

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final byte[]`
`EMPTY_BYTES`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`KotlinSerializationStringEncoder(T format, org.springframework.util.MimeType... supportedMimeTypes)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`canEncode(org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType)`
`reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>`
`encode(Publisher<?> inputStream, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`protected reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer>`
`encodeNonStream(Publisher<?> inputStream, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType elementType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`protected org.springframework.core.io.buffer.DataBuffer`
`encodeStreamingValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, org.springframework.util.MimeType mimeType, Map<String,Object> hints, byte[] prefix, byte[] suffix)`
`org.springframework.core.io.buffer.DataBuffer`
`encodeValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, org.springframework.util.MimeType mimeType, Map<String,Object> hints)`
`List<org.springframework.util.MimeType>`
`getEncodableMimeTypes()`
`List<org.springframework.util.MimeType>`
`getEncodableMimeTypes(org.springframework.core.ResolvableType elementType)`
`void`
`setStreamingMediaTypes(Collection<MediaType> streamingMediaTypes)`
Set streaming `MediaTypes`.

### Methods inherited from class org.springframework.http.codec.KotlinSerializationSupport

`canSerialize, format, serializer, supportedMimeTypes`

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

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

## Field Details

### EMPTY_BYTES

protected static final byte[] EMPTY_BYTES

## Constructor Details

### KotlinSerializationStringEncoder

protected KotlinSerializationStringEncoder(T format, org.springframework.util.MimeType... supportedMimeTypes)

## Method Details

### setStreamingMediaTypes

public void setStreamingMediaTypes(Collection<MediaType> streamingMediaTypes)
Set streaming `MediaTypes`.

Parameters:
  `streamingMediaTypes` - streaming `MediaTypes`
Since:
  6.1.4

### canEncode

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

Specified by:
  `canEncode` in interface `org.springframework.core.codec.Encoder<T extends kotlinx.serialization.StringFormat>`

### getEncodableMimeTypes

public List<org.springframework.util.MimeType> getEncodableMimeTypes()

Specified by:
  `getEncodableMimeTypes` in interface `org.springframework.core.codec.Encoder<T extends kotlinx.serialization.StringFormat>`

### getEncodableMimeTypes

public List<org.springframework.util.MimeType> getEncodableMimeTypes(org.springframework.core.ResolvableType elementType)

Specified by:
  `getEncodableMimeTypes` in interface `org.springframework.core.codec.Encoder<T extends kotlinx.serialization.StringFormat>`

### encode

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

Specified by:
  `encode` in interface `org.springframework.core.codec.Encoder<T extends kotlinx.serialization.StringFormat>`

### encodeStreamingValue

protected org.springframework.core.io.buffer.DataBuffer encodeStreamingValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints, byte[] prefix, byte[] suffix)

### encodeNonStream

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

### encodeValue

public org.springframework.core.io.buffer.DataBuffer encodeValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)

Specified by:
  `encodeValue` in interface `org.springframework.core.codec.Encoder<T extends kotlinx.serialization.StringFormat>`