org.restlet.client.representation
Class EmptyRepresentation

java.lang.Object
  extended by org.restlet.client.representation.Variant
      extended by org.restlet.client.representation.RepresentationInfo
          extended by org.restlet.client.representation.Representation
              extended by org.restlet.client.representation.EmptyRepresentation

public class EmptyRepresentation
extends Representation

Empty representation with no content. It is always considered available but calling the getText() method for example will return an empty string. It can also have regular metadata available.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.client.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
EmptyRepresentation()
          Constructor.
 
Method Summary
 Reader getReader()
          Returns a characters reader with the representation's content.
 InputStream getStream()
          Returns a stream with the representation's content.
 String getText()
          Converts the representation to a string value.
 
Methods inherited from class org.restlet.client.representation.Representation
append, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, getSize, hasKnownSize, isAvailable, isEmpty, isTransient, release, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.client.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.client.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmptyRepresentation

public EmptyRepresentation()
Constructor.

Method Detail

getReader

public Reader getReader()
                 throws IOException
Description copied from class: Representation
Returns a characters reader with the representation's content. This method is ensured to return a fresh reader for each invocation unless it is a transient representation, in which case null is returned. If the representation has no character set defined, the system's default one will be used.

Specified by:
getReader in class Representation
Returns:
A reader with the representation's content.
Throws:
IOException

getStream

public InputStream getStream()
                      throws IOException
Description copied from class: Representation
Returns a stream with the representation's content. This method is ensured to return a fresh stream for each invocation unless it is a transient representation, in which case null is returned.

Specified by:
getStream in class Representation
Returns:
A stream with the representation's content.
Throws:
IOException

getText

public String getText()
               throws IOException
Description copied from class: Representation
Converts the representation to a string value. Be careful when using this method as the conversion of large content to a string fully stored in memory can result in OutOfMemoryErrors being thrown.

Specified by:
getText in class Representation
Returns:
The representation as a string value.
Throws:
IOException


Copyright © 2005-2013 Restlet.