Class AbstractMessageReaderWriterProvider<T>
java.lang.Object
org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider<T>
- Type Parameters:
T
- Java type supported by the provider
- All Implemented Interfaces:
MessageBodyReader<T>
,MessageBodyWriter<T>
- Direct Known Subclasses:
AbstractFormProvider
,AbstractJaxbProvider
,ByteArrayProvider
,DataSourceProvider
,DocumentProvider
,FileProvider
,InputStreamProvider
,JsonBindingProvider
,ReaderProvider
,RenderedImageProvider
public abstract class AbstractMessageReaderWriterProvider<T>
extends Object
implements MessageBodyReader<T>, MessageBodyWriter<T>
Abstract entity provider (reader and writer) base class.
- Author:
- Paul Sandoz, Marek Potociar
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Charset
Deprecated.useReaderWriter.getCharset(m)
insteadlong
static String
readFromAsString
(InputStream in, MediaType type) Deprecated.useReaderWriter.readFromAsString(in, type)
insteadstatic void
writeTo
(InputStream in, OutputStream out) Deprecated.useReaderWriter.writeTo(in, out)
instead.static void
Deprecated.useReaderWriter.writeTo(in, out)
instead.static void
writeToAsString
(String s, OutputStream out, MediaType type) Deprecated.useReaderWriter.writeToAsString(s, out, type)
insteadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.ws.rs.ext.MessageBodyReader
isReadable, readFrom
Methods inherited from interface jakarta.ws.rs.ext.MessageBodyWriter
isWriteable, writeTo
-
Field Details
-
UTF8
Deprecated.useStandardCharsets.UTF_8
instead.The UTF-8 Charset.
-
-
Constructor Details
-
AbstractMessageReaderWriterProvider
public AbstractMessageReaderWriterProvider()
-
-
Method Details
-
writeTo
Deprecated.useReaderWriter.writeTo(in, out)
instead.Reader bytes from an input stream and write then to an output stream.- Parameters:
in
- the input stream to read from.out
- the output stream to write to.- Throws:
IOException
- if there is an error reading or writing bytes.
-
writeTo
Deprecated.useReaderWriter.writeTo(in, out)
instead.Reader characters from an input stream and write then to an output stream.- Parameters:
in
- the reader to read from.out
- the writer to write to.- Throws:
IOException
- if there is an error reading or writing characters.
-
getCharset
Deprecated.useReaderWriter.getCharset(m)
insteadGet the character set from a media type.The character set is obtained from the media type parameter "charset". If the parameter is not present the
StandardCharsets.UTF_8
charset is utilized.- Parameters:
m
- the media type.- Returns:
- the character set.
-
readFromAsString
@Deprecated public static String readFromAsString(InputStream in, MediaType type) throws IOException Deprecated.useReaderWriter.readFromAsString(in, type)
insteadRead the bytes of an input stream and convert to a string.- Parameters:
in
- the input stream to read from.type
- the media type that determines the character set defining how to decode bytes to characters.- Returns:
- the string.
- Throws:
IOException
- if there is an error reading from the input stream.
-
writeToAsString
@Deprecated public static void writeToAsString(String s, OutputStream out, MediaType type) throws IOException Deprecated.useReaderWriter.writeToAsString(s, out, type)
insteadConvert a string to bytes and write those bytes to an output stream.- Parameters:
s
- the string to convert to bytes.out
- the output stream to write to.type
- the media type that determines the character set defining how to decode bytes to characters.- Throws:
IOException
- in case of a write failure.
-
getSize
public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) - Specified by:
getSize
in interfaceMessageBodyWriter<T>
-
StandardCharsets.UTF_8
instead.