@Singleton @Internal public class TextStreamCodec extends java.lang.Object implements MediaTypeCodec
MediaTypeCodec that will encode Event objects in order to support Server Sent Events.| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CONFIGURATION_QUALIFIER  | 
| Modifier | Constructor and Description | 
|---|---|
  | 
TextStreamCodec(ApplicationConfiguration applicationConfiguration,
               ByteBufferFactory byteBufferFactory,
               BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider,
               CodecConfiguration codecConfiguration)  | 
protected  | 
TextStreamCodec(java.nio.charset.Charset defaultCharset,
               ByteBufferFactory byteBufferFactory,
               BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider,
               CodecConfiguration codecConfiguration)  | 
| Modifier and Type | Method and Description | 
|---|---|
<T> T | 
decode(Argument<T> type,
      java.io.InputStream inputStream)
Decode the given type from the given  
InputStream. | 
<T> T | 
decode(java.lang.Class<T> type,
      java.io.InputStream inputStream)
Decode the given type from the given  
InputStream. | 
<T> byte[] | 
encode(T object)
Encode the given type returning the object as a byte[]. 
 | 
<T,B> ByteBuffer<B> | 
encode(T object,
      ByteBufferFactory<?,B> allocator)
Encode the given type returning the object as a  
ByteBuffer. | 
<T> void | 
encode(T object,
      java.io.OutputStream outputStream)
Encode the given type to the given  
OutputStream. | 
java.util.Collection<MediaType> | 
getMediaTypes()  | 
protected void | 
writeAttribute(ByteBuffer eventData,
              byte[] attribute,
              java.lang.String value)  | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, decode, decode, decode, decode, decode, supportsTypepublic static final java.lang.String CONFIGURATION_QUALIFIER
@Inject public TextStreamCodec(ApplicationConfiguration applicationConfiguration, ByteBufferFactory byteBufferFactory, BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider, @Named(value="text-stream") @Nullable CodecConfiguration codecConfiguration)
applicationConfiguration - The application configurationbyteBufferFactory - A byte buffer factorycodecRegistryProvider - A media type codec registrycodecConfiguration - The configuration for the codecprotected TextStreamCodec(java.nio.charset.Charset defaultCharset,
                          ByteBufferFactory byteBufferFactory,
                          BeanProvider<MediaTypeCodecRegistry> codecRegistryProvider,
                          @Named(value="text-stream") @Nullable
                          CodecConfiguration codecConfiguration)
defaultCharset - The default charsetbyteBufferFactory - A byte buffer factorycodecRegistryProvider - A media type codec registrycodecConfiguration - The configuration for the codecpublic java.util.Collection<MediaType> getMediaTypes()
getMediaTypes in interface MediaTypeCodecpublic <T> T decode(Argument<T> type, java.io.InputStream inputStream)
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streampublic <T> T decode(java.lang.Class<T> type,
                    java.io.InputStream inputStream)
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streampublic <T> void encode(T object,
                       java.io.OutputStream outputStream)
MediaTypeCodecOutputStream.encode in interface MediaTypeCodecT - The generic typeobject - The object to encodeoutputStream - The output streampublic <T> byte[] encode(T object)
MediaTypeCodecencode in interface MediaTypeCodecT - The generic typeobject - The object to encodepublic <T,B> ByteBuffer<B> encode(T object, ByteBufferFactory<?,B> allocator)
MediaTypeCodecByteBuffer.encode in interface MediaTypeCodecT - The generic typeB - The buffer typeobject - The object to encodeallocator - The allocatorprotected void writeAttribute(ByteBuffer eventData, byte[] attribute, java.lang.String value)
eventData - The byte bufferattribute - The attributevalue - The value