org.restlet.resource
Class StreamRepresentation

java.lang.Object
  extended by org.restlet.resource.Variant
      extended by org.restlet.resource.Representation
          extended by org.restlet.resource.StreamRepresentation
Direct Known Subclasses:
InputRepresentation, OutputRepresentation, StringRepresentation

public abstract class StreamRepresentation
extends Representation

Representation based on a BIO stream.

Author:
Jerome Louvel (contact@noelios.com)

Field Summary
 
Fields inherited from class org.restlet.resource.Variant
UNKNOWN_SIZE
 
Constructor Summary
StreamRepresentation(MediaType mediaType)
          Constructor.
 
Method Summary
 ReadableByteChannel getChannel()
          Returns a readable byte channel.
 void write(WritableByteChannel writableChannel)
          Writes the representation to a byte channel.
 
Methods inherited from class org.restlet.resource.Representation
getStream, getText, isAvailable, isTransient, setAvailable, setTransient, write
 
Methods inherited from class org.restlet.resource.Variant
getCharacterSet, getEncodings, getExpirationDate, getIdentifier, getLanguages, getMediaType, getModificationDate, getSize, getTag, setCharacterSet, setExpirationDate, setIdentifier, setIdentifier, setMediaType, setModificationDate, setSize, setTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamRepresentation

public StreamRepresentation(MediaType mediaType)
Constructor.

Parameters:
mediaType - The media type.
Method Detail

getChannel

public ReadableByteChannel getChannel()
                               throws IOException
Returns a readable byte channel. If it is supported by a file a read-only instance of FileChannel is returned.

Specified by:
getChannel in class Representation
Returns:
A readable byte channel.
Throws:
IOException

write

public void write(WritableByteChannel writableChannel)
           throws IOException
Writes the representation to a byte channel.

Specified by:
write in class Representation
Parameters:
writableChannel - A writable byte channel.
Throws:
IOException


Copyright © 2005-2007 Noelios Consulting.