public abstract class StreamRepresentation extends Representation
UNKNOWN_SIZE
Constructor and Description |
---|
StreamRepresentation(MediaType mediaType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.nio.channels.ReadableByteChannel |
getChannel()
Returns a channel with the representation's content.
If it is supported by a file, a read-only instance of FileChannel is returned. This method is ensured to return a fresh channel for each invocation unless it is a transient representation, in which case null is returned. |
java.io.Reader |
getReader()
Returns a characters reader with the representation's content.
|
void |
write(java.nio.channels.WritableByteChannel writableChannel)
Writes the representation to a byte channel.
|
void |
write(java.io.Writer writer)
Writes the representation to a characters writer.
|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getSize, getStream, getText, hasKnownSize, isAvailable, isEmpty, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setRange, setSize, setTransient, write
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
public StreamRepresentation(MediaType mediaType)
mediaType
- The media type.public java.nio.channels.ReadableByteChannel getChannel() throws java.io.IOException
Representation
getChannel
in class Representation
java.io.IOException
public java.io.Reader getReader() throws java.io.IOException
Representation
getReader
in class Representation
java.io.IOException
public void write(java.nio.channels.WritableByteChannel writableChannel) throws java.io.IOException
Representation
write
in class Representation
writableChannel
- A writable byte channel.java.io.IOException
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-2020 Restlet.