Package io.micronaut.http.server.codec
Class TextStreamCodec
java.lang.Object
io.micronaut.http.server.codec.TextStreamCodec
- All Implemented Interfaces:
MediaTypeCodec
@Singleton
@Internal
@Requires(bean=ByteBufferFactory.class)
@Deprecated(forRemoval=true,
since="4.7")
public class TextStreamCodec
extends Object
implements MediaTypeCodec
Deprecated, for removal: This API element is subject to removal in a future version.
Replaced with message body writers / readers API
A
MediaTypeCodec
that will encode Event
objects in order to support Server Sent Events.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ModifierConstructorDescriptionTextStreamCodec
(ApplicationConfiguration applicationConfiguration, ByteBufferFactory byteBufferFactory, BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider, @Nullable CodecConfiguration codecConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.protected
TextStreamCodec
(Charset defaultCharset, ByteBufferFactory byteBufferFactory, BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider, @Nullable CodecConfiguration codecConfiguration) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescription<T> T
decode
(Argument<T> type, InputStream inputStream) Deprecated, for removal: This API element is subject to removal in a future version.Decode the given type from the givenInputStream
.<T> T
decode
(Class<T> type, InputStream inputStream) Deprecated, for removal: This API element is subject to removal in a future version.Decode the given type from the givenInputStream
.<T> byte[]
encode
(T object) Deprecated, for removal: This API element is subject to removal in a future version.Encode the given type returning the object as a byte[].<T,
B> ByteBuffer<B> encode
(T object, ByteBufferFactory<?, B> allocator) Deprecated, for removal: This API element is subject to removal in a future version.Encode the given type returning the object as aByteBuffer
.<T> void
encode
(T object, OutputStream outputStream) Deprecated, for removal: This API element is subject to removal in a future version.Encode the given type to the givenOutputStream
.Deprecated, for removal: This API element is subject to removal in a future version.protected void
writeAttribute
(ByteBuffer eventData, byte[] attribute, String value) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
CONFIGURATION_QUALIFIER
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
-
Constructor Details
-
TextStreamCodec
@Inject public TextStreamCodec(ApplicationConfiguration applicationConfiguration, ByteBufferFactory byteBufferFactory, BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider, @Named("text-stream") @Nullable @Nullable CodecConfiguration codecConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
applicationConfiguration
- The application configurationbyteBufferFactory
- A byte buffer factorycodecRegistryProvider
- A media type codec registrycodecConfiguration
- The configuration for the codec
-
TextStreamCodec
protected TextStreamCodec(Charset defaultCharset, ByteBufferFactory byteBufferFactory, BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider, @Named("text-stream") @Nullable @Nullable CodecConfiguration codecConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
defaultCharset
- The default charsetbyteBufferFactory
- A byte buffer factorycodecRegistryProvider
- A media type codec registrycodecConfiguration
- The configuration for the codec
-
-
Method Details
-
getMediaTypes
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getMediaTypes
in interfaceMediaTypeCodec
- Returns:
- The media type of the codec
-
decode
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MediaTypeCodec
Decode the given type from the givenInputStream
.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeinputStream
- The input stream- Returns:
- The decoded result
-
decode
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MediaTypeCodec
Decode the given type from the givenInputStream
.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeinputStream
- The input stream- Returns:
- The decoded result
-
encode
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MediaTypeCodec
Encode the given type to the givenOutputStream
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
object
- The object to encodeoutputStream
- The output stream
-
encode
public <T> byte[] encode(T object) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as a byte[].- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
object
- The object to encode- Returns:
- The decoded result
-
encode
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as aByteBuffer
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic typeB
- The buffer type- Parameters:
object
- The object to encodeallocator
- The allocator- Returns:
- The decoded result
-
writeAttribute
Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
eventData
- The byte bufferattribute
- The attributevalue
- The value
-