Class TextStreamCodec

java.lang.Object
io.micronaut.http.server.codec.TextStreamCodec
All Implemented Interfaces:
io.micronaut.http.codec.MediaTypeCodec

@Singleton @Internal @Requires(bean=io.micronaut.core.io.buffer.ByteBufferFactory.class) @Deprecated(forRemoval=true, since="4.7") public class TextStreamCodec extends Object implements io.micronaut.http.codec.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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    TextStreamCodec(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.core.io.buffer.ByteBufferFactory byteBufferFactory, io.micronaut.context.BeanProvider<io.micronaut.http.codec.MediaTypeCodecRegistry> codecRegistryProvider, @Nullable io.micronaut.http.codec.CodecConfiguration codecConfiguration)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected
    TextStreamCodec(Charset defaultCharset, io.micronaut.core.io.buffer.ByteBufferFactory byteBufferFactory, io.micronaut.context.BeanProvider<io.micronaut.http.codec.MediaTypeCodecRegistry> codecRegistryProvider, @Nullable io.micronaut.http.codec.CodecConfiguration codecConfiguration)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    decode(io.micronaut.core.type.Argument<T> type, InputStream inputStream)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T
    decode(Class<T> type, InputStream inputStream)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> byte[]
    encode(T object)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T, B> io.micronaut.core.io.buffer.ByteBuffer<B>
    encode(T object, io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> void
    encode(T object, OutputStream outputStream)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Collection<io.micronaut.http.MediaType>
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected void
    writeAttribute(io.micronaut.core.io.buffer.ByteBuffer eventData, byte[] attribute, String value)
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.micronaut.http.codec.MediaTypeCodec

    decode, decode, decode, decode, decode, decode, encode, encode, encode, supportsType
  • Field Details

    • CONFIGURATION_QUALIFIER

      public static final String CONFIGURATION_QUALIFIER
      Deprecated, for removal: This API element is subject to removal in a future version.
      See Also:
  • Constructor Details

    • TextStreamCodec

      @Inject public TextStreamCodec(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.core.io.buffer.ByteBufferFactory byteBufferFactory, io.micronaut.context.BeanProvider<io.micronaut.http.codec.MediaTypeCodecRegistry> codecRegistryProvider, @Named("text-stream") @Nullable @Nullable io.micronaut.http.codec.CodecConfiguration codecConfiguration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      applicationConfiguration - The application configuration
      byteBufferFactory - A byte buffer factory
      codecRegistryProvider - A media type codec registry
      codecConfiguration - The configuration for the codec
    • TextStreamCodec

      protected TextStreamCodec(Charset defaultCharset, io.micronaut.core.io.buffer.ByteBufferFactory byteBufferFactory, io.micronaut.context.BeanProvider<io.micronaut.http.codec.MediaTypeCodecRegistry> codecRegistryProvider, @Named("text-stream") @Nullable @Nullable io.micronaut.http.codec.CodecConfiguration codecConfiguration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      defaultCharset - The default charset
      byteBufferFactory - A byte buffer factory
      codecRegistryProvider - A media type codec registry
      codecConfiguration - The configuration for the codec
  • Method Details

    • getMediaTypes

      public Collection<io.micronaut.http.MediaType> getMediaTypes()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getMediaTypes in interface io.micronaut.http.codec.MediaTypeCodec
    • decode

      public <T> T decode(io.micronaut.core.type.Argument<T> type, InputStream inputStream)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      decode in interface io.micronaut.http.codec.MediaTypeCodec
    • decode

      public <T> T decode(Class<T> type, InputStream inputStream)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      decode in interface io.micronaut.http.codec.MediaTypeCodec
    • encode

      public <T> void encode(T object, OutputStream outputStream)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      encode in interface io.micronaut.http.codec.MediaTypeCodec
    • encode

      public <T> byte[] encode(T object)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      encode in interface io.micronaut.http.codec.MediaTypeCodec
    • encode

      public <T, B> io.micronaut.core.io.buffer.ByteBuffer<B> encode(T object, io.micronaut.core.io.buffer.ByteBufferFactory<?,B> allocator)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      encode in interface io.micronaut.http.codec.MediaTypeCodec
    • writeAttribute

      protected void writeAttribute(io.micronaut.core.io.buffer.ByteBuffer eventData, byte[] attribute, String value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      eventData - The byte buffer
      attribute - The attribute
      value - The value