public interface IEncodingFactory
Note on naming convention: normally the prefix I
for interfaces is avoided in Java, in this particular
case I decided to use it as the concrete class EncodingFactory
is the actual factory and the main access for
encoding related information. This interface is used for connection specific factories (eg so the defaultEncoding is
the connection character set).
Modifier and Type | Method and Description |
---|---|
CharacterTranslator |
getCharacterTranslator(java.lang.String mappingPath)
Deprecated.
To be removed in Jaybird 4
|
Encoding |
getDefaultEncoding() |
EncodingDefinition |
getDefaultEncodingDefinition()
Returns the
EncodingDefinition for the default platform character set. |
EncodingDefinition |
getEncodingDefinition(java.lang.String firebirdEncodingName,
java.lang.String javaCharsetAlias)
Gets or creates an
EncodingDefinition for the supplied Firebird encoding and Java charset. |
EncodingDefinition |
getEncodingDefinitionByCharacterSetId(int firebirdCharacterSetId)
Looks up the
EncodingDefinition for the specified Firebird character set id. |
EncodingDefinition |
getEncodingDefinitionByCharset(java.nio.charset.Charset charset)
Looks up an
EncodingDefinition for the Java Charset . |
EncodingDefinition |
getEncodingDefinitionByCharsetAlias(java.lang.String charsetAlias)
Looks up the
EncodingDefinition by the specified Java character set name or
alias. |
EncodingDefinition |
getEncodingDefinitionByFirebirdName(java.lang.String firebirdEncodingName)
Looks up the
EncodingDefinition for the specified Firebird encoding name. |
Encoding |
getEncodingForCharacterSetId(int firebirdCharacterSetId)
Gets an
Encoding for the specified Firebird character set id. |
Encoding |
getEncodingForCharset(java.nio.charset.Charset charset)
Gets an
Encoding for the specified Java character set. |
Encoding |
getEncodingForCharset(java.nio.charset.Charset charset,
Encoding fallbackEncoding)
Gets an
Encoding for the specified Java character set. |
Encoding |
getEncodingForCharsetAlias(java.lang.String charsetAlias)
Gets an
Encoding for the specified Java character set name or alias. |
Encoding |
getEncodingForFirebirdName(java.lang.String firebirdEncodingName)
Gets an
Encoding for the specified Firebird encoding. |
Encoding |
getOrCreateEncodingForCharset(java.nio.charset.Charset charset)
Creates an
Encoding for the specified Java character set. |
IEncodingFactory |
withDefaultEncodingDefinition(java.nio.charset.Charset charset)
|
IEncodingFactory |
withDefaultEncodingDefinition(EncodingDefinition encodingDefinition)
Returns an
IEncodingFactory that uses encodingDefinition as the
default. |
Encoding getDefaultEncoding()
Encoding
for Charset.defaultCharset()
.EncodingDefinition getDefaultEncodingDefinition()
EncodingDefinition
for the default platform character set.
If the default character set is not supported by Jaybird, an instance of EncodingDefinition should be returned
with Firebird encoding name "NONE"
.
EncodingDefinition
for Charset.defaultCharset()
.EncodingDefinition getEncodingDefinitionByFirebirdName(java.lang.String firebirdEncodingName)
EncodingDefinition
for the specified Firebird encoding name.firebirdEncodingName
- The Firebird encoding name (case insensitive)null
if the encoding name is unknownEncoding getEncodingForFirebirdName(java.lang.String firebirdEncodingName)
Encoding
for the specified Firebird encoding. If there is no known
encoding for this name,
or the loaded EncodingDefinition is information-only, then the defaultEncoding is used.firebirdEncodingName
- The Firebird encoding name (case insensitive)EncodingDefinition getEncodingDefinitionByCharacterSetId(int firebirdCharacterSetId)
EncodingDefinition
for the specified Firebird character set id.
Implementations that do not know the connection character set should return null
for the
value ISCConstants.CS_dynamic
(= 127), as that is the indicator to use
the connection character set.
firebirdCharacterSetId
- Firebird character set idnull
if the character set id is unknown or 127
and this
implementation doesn't know the connection character set.Encoding getEncodingForCharacterSetId(int firebirdCharacterSetId)
Encoding
for the specified Firebird character set id. If there is no
known encoding for this character set id (or if it is 127,
see getEncodingDefinitionByCharacterSetId(int)
), or the loaded EncodingDefinition is information-only,
then the defaultEncoding will be used.firebirdCharacterSetId
- The Firebird character set idEncodingDefinition getEncodingDefinitionByCharset(java.nio.charset.Charset charset)
EncodingDefinition
for the Java Charset
.charset
- The Java character setnull
if the character set is not mappedEncoding getEncodingForCharset(java.nio.charset.Charset charset, Encoding fallbackEncoding)
Encoding
for the specified Java character set. If there is no known
encoding for this Charset
, or the loaded EncodingDefinition is information-only, then
the fallbackEncoding will be used.charset
- The Java character setfallbackEncoding
- The Encoding to use as fallback if no encoding is found (usually the connection encoding). If
null
, the defaultEncoding for the JVM is used.getOrCreateEncodingForCharset(java.nio.charset.Charset)
Encoding getEncodingForCharset(java.nio.charset.Charset charset)
Encoding
for the specified Java character set. If there is no known
encoding for this Charset
, or the loaded EncodingDefinition is information-only, then
the defaultEncoding will be used.charset
- The Java character setEncoding getOrCreateEncodingForCharset(java.nio.charset.Charset charset)
Encoding
for the specified Java character set. If there is no known encoding for this
charset, then an Encoding instance based on the charset is returned.
In general the method getEncodingForCharset(java.nio.charset.Charset, Encoding)
should be used.
Don't confuse this method with getEncodingForCharset(Charset)
, which falls back to the default
encoding.
charset
- The Java character setgetEncodingForCharset(java.nio.charset.Charset, Encoding)
EncodingDefinition getEncodingDefinitionByCharsetAlias(java.lang.String charsetAlias)
EncodingDefinition
by the specified Java character set name or
alias.charsetAlias
- Name (or alias) of the Java character set (case insensitive)null
if the character set name is not mappedEncoding getEncodingForCharsetAlias(java.lang.String charsetAlias)
Encoding
for the specified Java character set name or alias. If there
is no known encoding for
this name, or the loaded EncodingDefinition is information-only, then the defaultEncoding will be used.charsetAlias
- The Java character set name or alias@Deprecated CharacterTranslator getCharacterTranslator(java.lang.String mappingPath) throws java.sql.SQLException
CharacterTranslator
for the specified mappingPath.mappingPath
- Path of the file with mapping definitionjava.sql.SQLException
EncodingDefinition getEncodingDefinition(java.lang.String firebirdEncodingName, java.lang.String javaCharsetAlias)
EncodingDefinition
for the supplied Firebird encoding and Java charset.
When firebirdEncodingName
is not null and javaCharsetAlias
is null, then the
encoding definition as returned by getEncodingDefinitionByFirebirdName(String)
is returned. For the
reverse (firebirdEncodingName
is null and javaCharsetAlias
isn't), the encoding
definition
as returned by getEncodingDefinitionByCharsetAlias(String)
is returned.
When both parameters are set, the result of getEncodingDefinitionByFirebirdName(String)
is returned if
the
character set matches, otherwise a new DefaultEncodingDefinition
is created based on its information,
but
with the specified character set. This can be useful for attempting to fix encoding issues in Firebird.
If either of the parameters cannot be resolved, to an EncodingDefinition or Charset
, or the
EncodingDefinition
is information-only - with the exception of Firebird encoding NONE - and no Java Charset is specified, then null
is returned.
firebirdEncodingName
- Name of the Firebird encoding, or null to defer decision to the java Charset aliasjavaCharsetAlias
- Alias of the Java character set, or null to defer decision to the Firebird encodingIEncodingFactory withDefaultEncodingDefinition(EncodingDefinition encodingDefinition)
IEncodingFactory
that uses encodingDefinition
as the
default.encodingDefinition
- The default encoding to use (or null
for the value of getDefaultEncoding()
IEncodingFactory withDefaultEncodingDefinition(java.nio.charset.Charset charset)
charset
- The default charset to use.Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.