@Singleton @Internal public class TextStreamCodec extends Object implements MediaTypeCodec
MediaTypeCodec that will encode Event objects in order to support Server Sent Events.| Modifier and Type | Field and Description | 
|---|---|
static String | 
CONFIGURATION_QUALIFIER  | 
| Constructor and Description | 
|---|
TextStreamCodec(HttpServerConfiguration serverConfiguration,
               ByteBufferFactory byteBufferFactory,
               Provider<MediaTypeCodecRegistry> codecRegistryProvider,
               CodecConfiguration codecConfiguration)  | 
| Modifier and Type | Method and Description | 
|---|---|
<T> T | 
decode(Argument<T> type,
      InputStream inputStream)
Decode the given type from the given  
InputStream. | 
<T> T | 
decode(Class<T> type,
      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> ByteBuffer | 
encode(T object,
      ByteBufferFactory allocator)
Encode the given type returning the object as a  
ByteBuffer. | 
<T> void | 
encode(T object,
      OutputStream outputStream)
Encode the given type from the given  
InputStream. | 
Collection<MediaType> | 
getMediaTypes()  | 
protected void | 
writeAttribute(ByteBuffer eventData,
              byte[] attribute,
              String value)  | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, decode, decode, decode, decode, decode, supportsTypepublic static final String CONFIGURATION_QUALIFIER
public TextStreamCodec(HttpServerConfiguration serverConfiguration, ByteBufferFactory byteBufferFactory, Provider<MediaTypeCodecRegistry> codecRegistryProvider, @Named(value="text-stream") @Nullable CodecConfiguration codecConfiguration)
serverConfiguration - The HTTP server configurationbyteBufferFactory - A byte buffer factorycodecRegistryProvider - A media type codec registrycodecConfiguration - The configuration for the codecpublic Collection<MediaType> getMediaTypes()
getMediaTypes in interface MediaTypeCodecpublic <T> T decode(Argument<T> type, InputStream inputStream) throws CodecException
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decodedpublic <T> T decode(Class<T> type, InputStream inputStream) throws CodecException
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decodedpublic <T> void encode(T object,
                       OutputStream outputStream)
                throws CodecException
MediaTypeCodecInputStream.encode in interface MediaTypeCodecT - The generic typeobject - The object to encodeoutputStream - The input streamCodecException - When the result cannot be decodedpublic <T> byte[] encode(T object)
                  throws CodecException
MediaTypeCodecencode in interface MediaTypeCodecT - The generic typeobject - The object to encodeCodecException - When the result cannot be decodedpublic <T> ByteBuffer encode(T object, ByteBufferFactory allocator) throws CodecException
MediaTypeCodecByteBuffer.encode in interface MediaTypeCodecT - The generic typeobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be decodedprotected void writeAttribute(ByteBuffer eventData, byte[] attribute, String value)
eventData - The byte bufferattribute - The attributevalue - The value