org.restlet.representation
Class AppendableRepresentation

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.representation.CharacterRepresentation
                  extended by org.restlet.representation.StringRepresentation
                      extended by org.restlet.representation.AppendableRepresentation
All Implemented Interfaces:
Appendable

public class AppendableRepresentation
extends StringRepresentation
implements Appendable

Represents an appendable sequence of characters.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
AppendableRepresentation()
          Constructor.
AppendableRepresentation(CharSequence text)
          Constructor.
AppendableRepresentation(CharSequence text, Language language)
          Constructor.
AppendableRepresentation(CharSequence text, MediaType mediaType)
          Constructor.
AppendableRepresentation(CharSequence text, MediaType mediaType, Language language)
          Constructor.
AppendableRepresentation(CharSequence text, MediaType mediaType, Language language, CharacterSet characterSet)
          Constructor.
 
Method Summary
 Appendable append(char c)
           
 Appendable append(CharSequence csq)
           
 Appendable append(CharSequence csq, int start, int end)
           
 String getText()
          Converts the representation to a string value.
 void setText(CharSequence text)
          Sets the string value.
 
Methods inherited from class org.restlet.representation.StringRepresentation
getReader, getStream, release, setCharacterSet, setText, toString, updateSize, write
 
Methods inherited from class org.restlet.representation.CharacterRepresentation
getChannel, write, write
 
Methods inherited from class org.restlet.representation.Representation
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppendableRepresentation

public AppendableRepresentation()
Constructor. The following metadata are used by default: "text/plain" media type, no language and the ISO-8859-1 character set.


AppendableRepresentation

public AppendableRepresentation(CharSequence text)
Constructor. The following metadata are used by default: "text/plain" media type, no language and the ISO-8859-1 character set.

Parameters:
text - The string value.

AppendableRepresentation

public AppendableRepresentation(CharSequence text,
                                Language language)
Constructor. The following metadata are used by default: "text/plain" media type, no language and the ISO-8859-1 character set.

Parameters:
text - The string value.
language - The language.

AppendableRepresentation

public AppendableRepresentation(CharSequence text,
                                MediaType mediaType)
Constructor. The following metadata are used by default: no language and the ISO-8859-1 character set.

Parameters:
text - The string value.
mediaType - The media type.

AppendableRepresentation

public AppendableRepresentation(CharSequence text,
                                MediaType mediaType,
                                Language language)
Constructor. The following metadata are used by default: ISO-8859-1 character set.

Parameters:
text - The string value.
mediaType - The media type.
language - The language.

AppendableRepresentation

public AppendableRepresentation(CharSequence text,
                                MediaType mediaType,
                                Language language,
                                CharacterSet characterSet)
Constructor.

Parameters:
text - The string value.
mediaType - The media type.
language - The language.
characterSet - The character set.
Method Detail

append

public Appendable append(char c)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public Appendable append(CharSequence csq)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

append

public Appendable append(CharSequence csq,
                         int start,
                         int end)
                  throws IOException
Specified by:
append in interface Appendable
Throws:
IOException

getText

public String getText()
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.

Overrides:
getText in class StringRepresentation
Returns:
The representation as a string value.

setText

public void setText(CharSequence text)
Description copied from class: StringRepresentation
Sets the string value.

Overrides:
setText in class StringRepresentation
Parameters:
text - The string value.


Copyright © 2005-2013 Restlet.