T - Java type supported by the providerpublic abstract class AbstractMessageReaderWriterProvider<T> extends Object implements MessageBodyReader<T>, MessageBodyWriter<T>
| Modifier and Type | Field and Description |
|---|---|
static Charset |
UTF8
Deprecated.
use
StandardCharsets.UTF_8 instead. |
| Constructor and Description |
|---|
AbstractMessageReaderWriterProvider() |
| Modifier and Type | Method and Description |
|---|---|
static Charset |
getCharset(MediaType m)
Deprecated.
use
ReaderWriter.getCharset(m) instead |
long |
getSize(T t,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Originally, the method has been called before
writeTo to ascertain the length in bytes of the serialized form
of t. |
static String |
readFromAsString(InputStream in,
MediaType type)
Deprecated.
use
ReaderWriter.readFromAsString(in, type) instead |
static void |
writeTo(InputStream in,
OutputStream out)
Deprecated.
use
ReaderWriter.writeTo(in, out) instead. |
static void |
writeTo(Reader in,
Writer out)
Deprecated.
use
ReaderWriter.writeTo(in, out) instead. |
static void |
writeToAsString(String s,
OutputStream out,
MediaType type)
Deprecated.
use
ReaderWriter.writeToAsString(s, out, type) instead |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisReadable, readFromisWriteable, writeTo@Deprecated public static final Charset UTF8
StandardCharsets.UTF_8 instead.@Deprecated public static void writeTo(InputStream in, OutputStream out) throws IOException
ReaderWriter.writeTo(in, out) instead.in - the input stream to read from.out - the output stream to write to.IOException - if there is an error reading or writing bytes.@Deprecated public static void writeTo(Reader in, Writer out) throws IOException
ReaderWriter.writeTo(in, out) instead.in - the reader to read from.out - the writer to write to.IOException - if there is an error reading or writing characters.@Deprecated public static Charset getCharset(MediaType m)
ReaderWriter.getCharset(m) instead
The character set is obtained from the media type parameter "charset".
If the parameter is not present the StandardCharsets.UTF_8 charset is utilized.
m - the media type.@Deprecated public static String readFromAsString(InputStream in, MediaType type) throws IOException
ReaderWriter.readFromAsString(in, type) insteadin - the input stream to read from.type - the media type that determines the character set defining
how to decode bytes to characters.IOException - if there is an error reading from the input stream.@Deprecated public static void writeToAsString(String s, OutputStream out, MediaType type) throws IOException
ReaderWriter.writeToAsString(s, out, type) insteads - 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.IOException - in case of a write failure.public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
MessageBodyWriterwriteTo to ascertain the length in bytes of the serialized form
of t. A non-negative return value has been used in a HTTP Content-Length header.
As of JAX-RS 2.0, the method has been deprecated and the value returned by the method is ignored by a JAX-RS runtime.
All MessageBodyWriter implementations are advised to return -1 from the method. Responsibility to
compute the actual Content-Length header value has been delegated to JAX-RS runtime.
getSize in interface MessageBodyWriter<T>t - the instance to writetype - the class of instance that is to be written.genericType - the type of instance to be written. GenericEntity provides a way to
specify this information at runtime.annotations - an array of the annotations attached to the message entity instance.mediaType - the media type of the HTTP entity.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.