Package org.jaxxy.io
Class CharacterMessageBodyProvider<T>
- java.lang.Object
-
- org.jaxxy.io.MessageBodyProvider<T>
-
- org.jaxxy.io.CharacterMessageBodyProvider<T>
-
- Type Parameters:
T- the type supported by this provider
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<T>,javax.ws.rs.ext.MessageBodyWriter<T>
- Direct Known Subclasses:
JsonMessageBodyProvider
public abstract class CharacterMessageBodyProvider<T> extends MessageBodyProvider<T>
-
-
Constructor Summary
Constructors Constructor Description CharacterMessageBodyProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected CharsetdefaultCharset()Returns the default charset to be used by this provider if no other charset is specified.TreadFrom(Class<T> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream)protected abstract TreadFrom(Class<T> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Reader reader)Reads the HTTP entity from aReader.voidwriteTo(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream)protected abstract voidwriteTo(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, Writer writer)Writes the HTTP entity to aWriter.-
Methods inherited from class org.jaxxy.io.MessageBodyProvider
isReadable, isSupportedType, isWriteable
-
-
-
-
Method Detail
-
readFrom
protected abstract T readFrom(Class<T> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, Reader reader) throws IOException
Reads the HTTP entity from aReader. This is the character stream equivalent toMessageBodyReader.readFrom(Class, Type, Annotation[], MediaType, MultivaluedMap, InputStream).- Parameters:
type- the type that is to be read.genericType- the type of instance to be produced.annotations- an array of the annotations on the declaration of the artifact that will be initialized with the produced instance.mediaType- the media type of the HTTP entity.httpHeaders- the read-only HTTP headers associated with HTTP entity.reader- theReaderfor the HTTP entity. The implementation should NOT close this reader!- Returns:
- the entity
- Throws:
IOException- See Also:
MessageBodyReader.readFrom(Class, Type, Annotation[], MediaType, MultivaluedMap, InputStream)
-
writeTo
protected abstract void writeTo(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, Writer writer) throws IOException
Writes the HTTP entity to aWriter. This is the character stream equivalent toMessageBodyWriter.writeTo(Object, Class, Type, Annotation[], MediaType, MultivaluedMap, OutputStream).- Parameters:
t- the instance to write.type- the class of instance that is to be written.genericType- the type of instance to be written.annotations- an array of the annotations attached to the message entity instance.mediaType- the media type of the HTTP entity.httpHeaders- a mutable map of the HTTP message headers.writer- theWriterfor the HTTP entity. The implementation should NOT close this writer!- Throws:
IOException- See Also:
MessageBodyWriter.writeTo(Object, Class, Type, Annotation[], MediaType, MultivaluedMap, OutputStream)
-
readFrom
public final T readFrom(Class<T> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException
- Throws:
IOException
-
writeTo
public final void writeTo(T t, Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
- Throws:
IOException
-
defaultCharset
protected Charset defaultCharset()
Returns the default charset to be used by this provider if no other charset is specified. This default implementation returnsStandardCharsets.UTF_8.- Returns:
- the default charset (UTF-8)
-
-