public class InputRepresentation extends StreamRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
InputRepresentation(java.io.InputStream inputStream)
Constructor.
|
InputRepresentation(java.io.InputStream inputStream,
MediaType mediaType)
Constructor.
|
InputRepresentation(java.io.InputStream inputStream,
MediaType mediaType,
long expectedSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getStream()
Returns a stream with the representation's content.
|
java.lang.String |
getText()
Note that this method relies on
getStream() . |
void |
release()
Closes and releases the input stream.
|
void |
setStream(java.io.InputStream stream)
Sets the input stream to use.
|
void |
write(java.io.OutputStream outputStream)
Writes the representation to a byte stream.
|
getChannel, getReader, write, write
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
public InputRepresentation(java.io.InputStream inputStream)
inputStream
- The representation's stream.public InputRepresentation(java.io.InputStream inputStream, MediaType mediaType)
inputStream
- The representation's stream.mediaType
- The representation's media type.public InputRepresentation(java.io.InputStream inputStream, MediaType mediaType, long expectedSize)
inputStream
- The representation's stream.mediaType
- The representation's media type.expectedSize
- The expected input stream size.public java.io.InputStream getStream() throws java.io.IOException
Representation
getStream
in class Representation
java.io.IOException
public java.lang.String getText() throws java.io.IOException
getStream()
. This stream is
closed once fully read.getText
in class Representation
java.io.IOException
public void release()
release
in class Representation
public void setStream(java.io.InputStream stream)
stream
- The input stream to use.public void write(java.io.OutputStream outputStream) throws java.io.IOException
Representation
OutputStream
after writing to it as this will be handled by
the Restlet connectors automatically.write
in class Representation
outputStream
- The output stream.java.io.IOException
Copyright © 2005-2024 Restlet.