java.lang.Object
com.pervasive.datarush.io.CharsetEncoding
- All Implemented Interfaces:
Serializable
Describes the encoding format of character data. This encompasses not only
the character set used, but also the error handling for unencodable
characters.
The default settings are:
- The ISO-8859-1 character set is used.
- Encoding errors are resolved by replacement with the '?' character.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a container with default settings.CharsetEncoding(CharsetEncoding source) Creates a container initialized using the given character set specification.CharsetEncoding(String charsetName) Creates a container initialized the named character set and the default error policy.CharsetEncoding(String charsetName, String replacement) Creates a container initialized with the named character set, using a replacement error policy with the specified string.CharsetEncoding(String charsetName, CodingErrorAction errorAction) Creates a container initialized with the named character set, using the specified error policy. -
Method Summary
Modifier and TypeMethodDescriptionGets the character set.Gets the character set name.Gets the specified action for an encoding error.Gets the replacement value used when an error occurs.Gets a new decoder configured for the described encoding.Gets a new encoder configured for the described encoding.voidset(CharsetEncoding source) Copy the settings from the given character set specificationvoidsetCharset(Charset charset) Sets the character set.voidsetCharsetName(String charsetName) Sets the character set name.voidsetErrorAction(CodingErrorAction errorAction) Sets the action for an encoding error.voidsetReplacement(String replacement) Sets the error policy to be replacement with the specified string.toString()
-
Field Details
-
CHARSET_NAME
Default character set name.- See Also:
-
REPLACEMENT
Default replacement character.- See Also:
-
-
Constructor Details
-
CharsetEncoding
public CharsetEncoding()Creates a container with default settings. -
CharsetEncoding
Creates a container initialized the named character set and the default error policy.- Parameters:
charsetName- name of the charset. This must be a name which is recognized byCharset.forName(String).
-
CharsetEncoding
Creates a container initialized with the named character set, using the specified error policy. If a policy of replacement is selected, the default replacement string will be used.- Parameters:
charsetName- name of the charset. This must be a name which is recognized byCharset.forName(String).errorAction- specifies how encoding errors are to be handled
-
CharsetEncoding
Creates a container initialized with the named character set, using a replacement error policy with the specified string.- Parameters:
charsetName- name of the charset. This must be a name which is recognized byCharset.forName(String).replacement- replacement string to be used when handling encoding errors
-
CharsetEncoding
Creates a container initialized using the given character set specification.- Parameters:
source- character set data from which to initialize the settings
-
-
Method Details
-
set
Copy the settings from the given character set specification- Parameters:
source- specifier containing the desired settings
-
getCharset
Gets the character set.- Returns:
- the character set to use
-
setCharset
Sets the character set.- Parameters:
charset- the character set to use
-
getCharsetName
Gets the character set name.- Returns:
- the character set to use
-
setCharsetName
Sets the character set name.- Parameters:
charsetName- name of the charset- Throws:
UnsupportedCharsetException- if the named charset is not supported.
-
getErrorAction
Gets the specified action for an encoding error.- Returns:
- error action
-
setErrorAction
Sets the action for an encoding error.- Parameters:
errorAction- error action
-
getReplacement
Gets the replacement value used when an error occurs. This value is only used if the error action is set to replacement.- Returns:
- replacement value used for encoding errors
-
setReplacement
Sets the error policy to be replacement with the specified string.- Parameters:
replacement- replacement value to use for encoding errors- Throws:
IllegalArgumentException- if the replacement isnullor empty
-
newEncoder
Gets a new encoder configured for the described encoding.- Returns:
- a encoder matching the encoding configuration
-
newDecoder
Gets a new decoder configured for the described encoding.- Returns:
- a decoder matching the encoding configuration
-
toString
-