Package org.restlet.engine.header
Class PreferenceWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Preference header writer.
- Author:
- Jerome Louvel
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(Preference<?> pref) Appends a value.appendQuality(float quality) Formats a quality value.
If the quality is invalid, an IllegalArgumentException is thrown.static booleanisValidQuality(float quality) Indicates if the quality value is valid.static StringWrites a list of preferences with a comma separator.Methods inherited from class org.restlet.engine.header.HeaderWriter
append, append, append, append, append, append, appendComment, appendExtension, appendExtension, appendParameterSeparator, appendProduct, appendQuotedPair, appendQuotedString, appendSpace, appendToken, appendUriEncoded, appendValueSeparator, canWriteMethods 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
-
PreferenceWriter
public PreferenceWriter()
-
-
Method Details
-
isValidQuality
public static boolean isValidQuality(float quality) Indicates if the quality value is valid.- Parameters:
quality- The quality value.- Returns:
- True if the quality value is valid.
-
write
Writes a list of preferences with a comma separator.- Parameters:
prefs- The list of preferences.- Returns:
- The formatted list of preferences.
- Throws:
IOException
-
append
Description copied from class:HeaderWriterAppends a value.- Specified by:
appendin classHeaderWriter<Preference<?>>- Parameters:
pref- The value.- Returns:
- This writer.
-
appendQuality
Formats a quality value.
If the quality is invalid, an IllegalArgumentException is thrown.- Parameters:
quality- The quality value as a float.- Returns:
- This writer.
-