public class StringRepresentation extends CharacterRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
StringRepresentation(char[] chars)
Constructor.
|
StringRepresentation(java.lang.CharSequence text)
Constructor.
|
StringRepresentation(java.lang.CharSequence text,
Language language)
Constructor.
|
StringRepresentation(java.lang.CharSequence text,
MediaType mediaType)
Constructor.
|
StringRepresentation(java.lang.CharSequence text,
MediaType mediaType,
Language language)
Constructor.
|
StringRepresentation(java.lang.CharSequence text,
MediaType mediaType,
Language language,
CharacterSet characterSet)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.Reader |
getReader()
Returns a characters reader with the representation's content.
|
java.io.InputStream |
getStream()
Returns a stream with the representation's content.
|
java.lang.String |
getText()
Converts the representation to a string value.
|
void |
release()
Closes and releases the input stream.
|
void |
setCharacterSet(CharacterSet characterSet)
Sets the character set or null if not applicable.
|
void |
setText(java.lang.CharSequence text)
Sets the string value.
|
void |
setText(java.lang.String text)
Sets the string value.
|
java.lang.String |
toString() |
protected void |
updateSize()
Updates the expected size according to the current string value.
|
void |
write(java.io.Writer writer)
Writes the representation to a characters writer.
|
getChannel, write, write
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType
public StringRepresentation(char[] chars)
chars
- The characters array.public StringRepresentation(java.lang.CharSequence text)
text
- The string value.public StringRepresentation(java.lang.CharSequence text, Language language)
text
- The string value.language
- The language.public StringRepresentation(java.lang.CharSequence text, MediaType mediaType)
text
- The string value.mediaType
- The media type.public StringRepresentation(java.lang.CharSequence text, MediaType mediaType, Language language)
text
- The string value.mediaType
- The media type.language
- The language.public StringRepresentation(java.lang.CharSequence text, MediaType mediaType, Language language, CharacterSet characterSet)
text
- The string value.mediaType
- The media type.language
- The language.characterSet
- The character set.public java.io.Reader getReader() throws java.io.IOException
Representation
getReader
in class Representation
java.io.IOException
public java.io.InputStream getStream() throws java.io.IOException
Representation
getStream
in class CharacterRepresentation
java.io.IOException
public java.lang.String getText()
Representation
getText
in class Representation
public void release()
release
in class Representation
public void setCharacterSet(CharacterSet characterSet)
Variant
setCharacterSet
in class Variant
characterSet
- The character set or null if not applicable.public void setText(java.lang.CharSequence text)
text
- The string value.public void setText(java.lang.String text)
text
- The string value.protected void updateSize()
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-2024 Restlet.