public interface Transport
| Modifier and Type | Method and Description |
|---|---|
String |
contentType()
Returns the HTTP content type marshalled by this transport.
|
<T> T |
in(InputStream in,
Class<T> type)
Reads from a given inputstream and returns an object representing the unmarshalled
form of the underlying protocol data.
|
<T> T |
in(InputStream in,
com.google.inject.TypeLiteral<T> type)
Reads from a given inputstream and returns an object representing the unmarshalled
form of the underlying protocol data.
|
<T> void |
out(OutputStream out,
Class<T> type,
T data)
Converts a given object into transportable data and writes it to the provided
OutputStream.
|
<T> T in(InputStream in, Class<T> type) throws IOException
in - An inputstream to read data from. This stream will NOT be closed
by the implementation of this interface.type - The type to read in. The method will return an instance of this
type representing the data in the in stream.type representing the data in the provided
stream.IOException - Thrown if there is an error reading from this stream.<T> T in(InputStream in, com.google.inject.TypeLiteral<T> type) throws IOException
in - An inputstream to read data from. This stream will NOT be closed
by the implementation of this interface.type - The TypeLiteral which is representing a generic type to read in. The method will return an instance of the
generic type representing the data in the in stream.type representing the data in the provided
stream.IOException - Thrown if there is an error reading from this stream.<T> void out(OutputStream out, Class<T> type, T data) throws IOException
out - An open outputstream to write to. This stream will NOT be closed.type - The type of the data being serialized to the stream.data - An object representing the data to be written out.IOException - Thrown if there is an error writing to this stream.String contentType()
Text transport transforms plain
strings to and from the HTTP stream. Its content type is text/plain. This
is only a default (or suggested) content type. You may of course, return whatever
content type is most suitable if using this transport to deliver web responses.Copyright © 2015. All Rights Reserved.