public class ReaderRepresentation extends CharacterRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
ReaderRepresentation(java.io.Reader reader)
Constructor.
|
ReaderRepresentation(java.io.Reader reader,
MediaType mediaType)
Constructor.
|
ReaderRepresentation(java.io.Reader reader,
MediaType mediaType,
long expectedSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.Reader |
getReader()
Returns a characters reader with the representation's content.
|
java.lang.String |
getText()
Note that this method relies on
CharacterRepresentation.getStream() . |
void |
release()
Closes and releases the input stream.
|
void |
setReader(java.io.Reader reader)
Sets the reader to use.
|
void |
write(java.io.Writer writer)
Writes the representation to a characters writer.
|
getChannel, getStream, 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 ReaderRepresentation(java.io.Reader reader)
reader
- The representation's stream.public ReaderRepresentation(java.io.Reader reader, MediaType mediaType)
reader
- The representation's stream.mediaType
- The representation's media type.public ReaderRepresentation(java.io.Reader reader, MediaType mediaType, long expectedSize)
reader
- The representation's stream.mediaType
- The representation's media type.expectedSize
- The expected reader size in bytes.public java.io.Reader getReader() throws java.io.IOException
Representation
getReader
in class Representation
java.io.IOException
public java.lang.String getText() throws java.io.IOException
CharacterRepresentation.getStream()
. This stream is
closed once fully read.getText
in class Representation
java.io.IOException
public void release()
release
in class Representation
public void setReader(java.io.Reader reader)
reader
- The reader to use.public void write(java.io.Writer writer) throws java.io.IOException
Representation
Writer
after writing to it as this will be handled
by the Restlet connectors automatically.write
in class Representation
writer
- The characters writer.java.io.IOException
Copyright © 2005-2024 Restlet.