java.lang.Object
org.firebirdsql.encodings.DefaultEncodingDefinition
- All Implemented Interfaces:
EncodingDefinition
Definition of a Firebird encoding. This is the default implementation of
EncodingDefinition.- Since:
- 3.0
- Author:
- Mark Rotteveel
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultEncodingDefinition(String firebirdEncodingName, String charsetName, int maxBytesPerChar, int firebirdCharacterSetId, boolean firebirdOnly) Initializes an instance of DefaultEncodingDefinition.DefaultEncodingDefinition(String firebirdEncodingName, Charset charset, int maxBytesPerChar, int firebirdCharacterSetId, boolean firebirdOnly) Initializes an instance of DefaultEncodingDefinition. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns theEncodinginstance for this definition.intintinthashCode()booleanCan (or should) this encoding be used for reverse mapping from Java to Firebird.booleanCan this implementation create anEncodinginstance, or does it provide information only (e.g.toString()
-
Constructor Details
-
DefaultEncodingDefinition
public DefaultEncodingDefinition(String firebirdEncodingName, Charset charset, int maxBytesPerChar, int firebirdCharacterSetId, boolean firebirdOnly) Initializes an instance of DefaultEncodingDefinition.- Parameters:
firebirdEncodingName- Name of the Firebird encodingcharset- JavaCharsetinstance (nullfor information-only instances)maxBytesPerChar- Maximum number of bytes per character (eg 1 for ISO8859_1, 4 for UTF8, 3 for UNICODE-FSS)firebirdCharacterSetId- Firebird character set idfirebirdOnly- Mapping only applies from Firebird to Java, but not from Java to Firebird (e.g. Firebird UNICODE-FSS maps to Java UTF-8, but Java UTF-8 does not map to Firebird UNICODE-FSS (but to Firebird UTF8)
-
DefaultEncodingDefinition
public DefaultEncodingDefinition(String firebirdEncodingName, String charsetName, int maxBytesPerChar, int firebirdCharacterSetId, boolean firebirdOnly) Initializes an instance of DefaultEncodingDefinition.The actual Java character set is loaded on-demand. If the provided name cannot be resolved to a
Charsetat on-demand load time, it will be handled as information-only.- Parameters:
firebirdEncodingName- Name of the Firebird encodingcharsetName- Java character set name, ornullfor information-only instancesmaxBytesPerChar- Maximum number of bytes per character (eg 1 for ISO8859_1, 4 for UTF8, 3 for UNICODE-FSS)firebirdCharacterSetId- Firebird character set idfirebirdOnly- Mapping only applies from Firebird to Java, but not from Java to Firebird (e.g. Firebird UNICODE-FSS maps to Java UTF-8, but Java UTF-8 does not map to Firebird UNICODE-FSS (but to Firebird UTF8)
-
-
Method Details
-
getMaxBytesPerChar
public int getMaxBytesPerChar()- Specified by:
getMaxBytesPerCharin interfaceEncodingDefinition- Returns:
- Maximum number of bytes per character.
-
getJavaEncodingName
- Specified by:
getJavaEncodingNamein interfaceEncodingDefinition- Returns:
- Java name of the encoding
-
getJavaCharset
- Specified by:
getJavaCharsetin interfaceEncodingDefinition- Returns:
- Java
Charsetfor this encoding
-
getFirebirdEncodingName
- Specified by:
getFirebirdEncodingNamein interfaceEncodingDefinition- Returns:
- Firebird name of the encoding
-
getFirebirdCharacterSetId
public int getFirebirdCharacterSetId()- Specified by:
getFirebirdCharacterSetIdin interfaceEncodingDefinition- Returns:
- Firebird id of the encoding
-
isFirebirdOnly
public boolean isFirebirdOnly()Description copied from interface:EncodingDefinitionCan (or should) this encoding be used for reverse mapping from Java to Firebird.The best example of this is the Firebird character set
UNICODE-FSSwhich maps to the Java character setUTF-8, but when Java character setUTF-8is requested, Jaybird should (in general) map to Firebird character setUTF8.- Specified by:
isFirebirdOnlyin interfaceEncodingDefinition- Returns:
truewhen this encoding maps from Java to Firebird,falseotherwise
-
isInformationOnly
public boolean isInformationOnly()Description copied from interface:EncodingDefinitionCan this implementation create anEncodinginstance, or does it provide information only (e.g. about unsupported character sets)- Specified by:
isInformationOnlyin interfaceEncodingDefinition- Returns:
trueif this EncodingDefinition only provides information, and is not capable of building a concrete implementation.
-
getEncoding
Returns theEncodinginstance for this definition. The same object is returned each time this method is called.- Specified by:
getEncodingin interfaceEncodingDefinition- Returns:
- Encoding object or
nullif this is an information only EncodingDefinition - See Also:
-
toString
-
equals
-
hashCode
public int hashCode()
-