Package org.restlet.engine.header
Class HeaderWriter<V>
java.lang.Object
java.io.Writer
java.io.StringWriter
org.restlet.engine.header.HeaderWriter<V>
- Type Parameters:
V- The value type.
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
CacheDirectiveWriter,ChallengeWriter,CookieSettingWriter,CookieWriter,DimensionWriter,DispositionWriter,ExpectationWriter,MetadataWriter,MethodWriter,PreferenceWriter,RangeWriter,RecipientInfoWriter,StringWriter,TagWriter,WarningWriter
HTTP-style header writer.
- Author:
- Jerome Louvel
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(char[] cs) Appends an array of characters.append(int i) Appends an integer.append(long l) Appends a long.append(CharSequence csq) append(Collection<V> values) Appends a collection of values.abstract HeaderWriter<V>Appends a value.appendComment(String content) Appends a string as an HTTP comment, surrounded by parenthesis and with quoted pairs if needed.appendExtension(String name, String value) Appends an extension.appendExtension(NamedValue<String> extension) Formats and appends a parameter as an extension.Appends a semicolon as a parameter separator.appendProduct(String name, String version) Appends a product description.appendQuotedPair(char character) Appends a quoted character, prefixing it with a backslash.appendQuotedString(String content) Appends a quoted string.Appends a space character.appendToken(String token) Appends a token.appendUriEncoded(CharSequence source, CharacterSet characterSet) Formats and appends a source string as an URI encoded string.Appends a comma as a value separator.protected booleanIndicates if the value can be written to the header.Methods inherited from class java.io.StringWriter
append, close, flush, getBuffer, toString, write, write, write, writeMethods inherited from class java.io.Writer
nullWriter, write
-
Constructor Details
-
HeaderWriter
public HeaderWriter()
-
-
Method Details
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classStringWriter
-
append
Appends an array of characters.- Parameters:
cs- The array of characters.- Returns:
- This writer.
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classStringWriter
-
append
Appends a collection of values.- Parameters:
values- The collection of values to append.- Returns:
- This writer.
-
append
Appends an integer.- Parameters:
i- The value to append.- Returns:
- This writer.
-
append
Appends a long.- Parameters:
l- The value to append.- Returns:
- This writer.
-
append
Appends a value.- Parameters:
value- The value.- Returns:
- This writer.
-
appendComment
Appends a string as an HTTP comment, surrounded by parenthesis and with quoted pairs if needed.- Parameters:
content- The comment to write.- Returns:
- This writer.
-
appendExtension
Formats and appends a parameter as an extension. If the value is not a token, then it is quoted.- Parameters:
extension- The parameter to format as an extension.- Returns:
- This writer.
-
appendExtension
Appends an extension. If the value is not a token, then it is quoted.- Parameters:
name- The extension name.value- The extension value.- Returns:
- This writer.
-
appendParameterSeparator
Appends a semicolon as a parameter separator.- Returns:
- This writer.
-
appendProduct
Appends a product description.- Parameters:
name- The product name token.version- The product version token.- Returns:
- This writer.
-
appendQuotedPair
Appends a quoted character, prefixing it with a backslash.- Parameters:
character- The character to quote.- Returns:
- This writer.
-
appendQuotedString
Appends a quoted string.- Parameters:
content- The string to quote and write.- Returns:
- This writer.
-
appendSpace
Appends a space character.- Returns:
- This writer.
-
appendToken
Appends a token.- Parameters:
token- The token to write.- Returns:
- This writer.
-
appendUriEncoded
Formats and appends a source string as an URI encoded string.- Parameters:
source- The source string to format.characterSet- The supported character encoding.- Returns:
- This writer.
-
appendValueSeparator
Appends a comma as a value separator.- Returns:
- This writer.
-
canWrite
Indicates if the value can be written to the header. Useful to prevent the writing ofEncoding.IDENTITYconstants for example. By default it returns true for non null values.- Parameters:
value- The value to add.- Returns:
- True if the value can be added.
-