org.restlet.engine.application
Class RangeRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.util.WrapperRepresentation
                  extended by org.restlet.engine.application.RangeRepresentation

public class RangeRepresentation
extends WrapperRepresentation

Representation that exposes only a range of the content of a wrapped representation.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
RangeRepresentation(Representation wrappedRepresentation)
          Constructor.
RangeRepresentation(Representation wrappedRepresentation, Range range)
          Constructor.
 
Method Summary
 long getAvailableSize()
           
 ReadableByteChannel getChannel()
           
 Range getRange()
          Returns the range specific to this wrapper.
 Reader getReader()
           
 InputStream getStream()
           
 String getText()
           
 void setRange(Range range)
          Sets the range specific to this wrapper.
 void write(OutputStream outputStream)
           
 void write(WritableByteChannel writableChannel)
           
 void write(Writer writer)
           
 
Methods inherited from class org.restlet.util.WrapperRepresentation
exhaust, getCharacterSet, getDigest, getDisposition, getEncodings, getExpirationDate, getLanguages, getLocationRef, getMediaType, getModificationDate, getRegistration, getSize, getTag, getWrappedRepresentation, isAvailable, isSelectable, isTransient, release, setAvailable, setCharacterSet, setDigest, setDisposition, setEncodings, setExpirationDate, setLanguages, setLocationRef, setLocationRef, setMediaType, setModificationDate, setSize, setTag, setTransient
 
Methods inherited from class org.restlet.representation.Representation
append, hasKnownSize, isEmpty, setListener
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, includes, isCompatible, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RangeRepresentation

public RangeRepresentation(Representation wrappedRepresentation)
Constructor.

Parameters:
wrappedRepresentation - The wrapped representation with a complete content.

RangeRepresentation

public RangeRepresentation(Representation wrappedRepresentation,
                           Range range)
Constructor.

Parameters:
wrappedRepresentation - The wrapped representation with a complete content.
range - The range to expose.
Method Detail

getAvailableSize

public long getAvailableSize()
Overrides:
getAvailableSize in class WrapperRepresentation

getChannel

public ReadableByteChannel getChannel()
                               throws IOException
Overrides:
getChannel in class WrapperRepresentation
Throws:
IOException

getRange

public Range getRange()
Returns the range specific to this wrapper. The wrapped representation must not have a range set itself.

Overrides:
getRange in class WrapperRepresentation
Returns:
The range specific to this wrapper.

getReader

public Reader getReader()
                 throws IOException
Overrides:
getReader in class WrapperRepresentation
Throws:
IOException

getStream

public InputStream getStream()
                      throws IOException
Overrides:
getStream in class WrapperRepresentation
Throws:
IOException

getText

public String getText()
               throws IOException
Overrides:
getText in class WrapperRepresentation
Throws:
IOException

setRange

public void setRange(Range range)
Sets the range specific to this wrapper. This will not affect the wrapped representation.

Overrides:
setRange in class WrapperRepresentation
Parameters:
range - The range specific to this wrapper.

write

public void write(Writer writer)
           throws IOException
Overrides:
write in class WrapperRepresentation
Throws:
IOException

write

public void write(OutputStream outputStream)
           throws IOException
Overrides:
write in class WrapperRepresentation
Throws:
IOException

write

public void write(WritableByteChannel writableChannel)
           throws IOException
Overrides:
write in class WrapperRepresentation
Throws:
IOException


Copyright © 2005-2013 Restlet.