public class CharsetEncoding extends Object implements Serializable
Charset
,
CodingErrorAction
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
CHARSET_NAME
Default character set name.
|
static String |
REPLACEMENT
Default replacement character.
|
Constructor and Description |
---|
CharsetEncoding()
Creates 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,
CodingErrorAction errorAction)
Creates a container initialized with the named character set, using the
specified 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.
|
Modifier and Type | Method and Description |
---|---|
Charset |
getCharset()
Gets the character set.
|
String |
getCharsetName()
Gets the character set name.
|
CodingErrorAction |
getErrorAction()
Gets the specified action for an encoding error.
|
String |
getReplacement()
Gets the replacement value used when an error occurs.
|
CharsetDecoder |
newDecoder()
Gets a new decoder configured for the described encoding.
|
CharsetEncoder |
newEncoder()
Gets a new encoder configured for the described encoding.
|
void |
set(CharsetEncoding source)
Copy the settings from the given character set specification
|
void |
setCharset(Charset charset)
Sets the character set.
|
void |
setCharsetName(String charsetName)
Sets the character set name.
|
void |
setErrorAction(CodingErrorAction errorAction)
Sets the action for an encoding error.
|
void |
setReplacement(String replacement)
Sets the error policy to be replacement with the specified string.
|
String |
toString() |
public static final String CHARSET_NAME
public static final String REPLACEMENT
public CharsetEncoding()
public CharsetEncoding(String charsetName)
charsetName
- name of the charset. This must be a name which is
recognized by Charset.forName(String)
.public CharsetEncoding(String charsetName, CodingErrorAction errorAction)
charsetName
- name of the charset. This must be a name which is
recognized by Charset.forName(String)
.errorAction
- specifies how encoding errors are to be handledpublic CharsetEncoding(String charsetName, String replacement)
charsetName
- name of the charset. This must be a name which is
recognized by Charset.forName(String)
.replacement
- replacement string to be used when handling encoding
errorspublic CharsetEncoding(CharsetEncoding source)
source
- character set data from which to initialize the settingspublic void set(CharsetEncoding source)
source
- specifier containing the desired settingspublic Charset getCharset()
public void setCharset(Charset charset)
charset
- the character set to usepublic String getCharsetName()
public void setCharsetName(String charsetName)
charsetName
- name of the charsetUnsupportedCharsetException
- if the named charset is not supported.public CodingErrorAction getErrorAction()
public void setErrorAction(CodingErrorAction errorAction)
errorAction
- error actionpublic String getReplacement()
public void setReplacement(String replacement)
replacement
- replacement value to use for encoding errorsIllegalArgumentException
- if the replacement is null
or emptypublic CharsetEncoder newEncoder()
public CharsetDecoder newDecoder()
Copyright © 2020 Actian Corporation. All rights reserved.