Interface IEncodingFactory
- 
- All Known Implementing Classes:
- EncodingFactory
 
 public interface IEncodingFactoryInterface for the EncodingFactory.Note on naming convention: normally the prefix Ifor interfaces is avoided in Java, in this particular case I decided to use it as the concrete classEncodingFactoryis 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).- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description EncodinggetDefaultEncoding()EncodingDefinitiongetDefaultEncodingDefinition()Returns theEncodingDefinitionfor the default platform character set.EncodingDefinitiongetEncodingDefinition(java.lang.String firebirdEncodingName, java.lang.String javaCharsetAlias)Gets or creates anEncodingDefinitionfor the supplied Firebird encoding and Java charset.EncodingDefinitiongetEncodingDefinitionByCharacterSetId(int firebirdCharacterSetId)Looks up theEncodingDefinitionfor the specified Firebird character set id.EncodingDefinitiongetEncodingDefinitionByCharset(java.nio.charset.Charset charset)Looks up anEncodingDefinitionfor the JavaCharset.EncodingDefinitiongetEncodingDefinitionByCharsetAlias(java.lang.String charsetAlias)Looks up theEncodingDefinitionby the specified Java character set name or alias.EncodingDefinitiongetEncodingDefinitionByFirebirdName(java.lang.String firebirdEncodingName)Looks up theEncodingDefinitionfor the specified Firebird encoding name.EncodinggetEncodingForCharacterSetId(int firebirdCharacterSetId)Gets anEncodingfor the specified Firebird character set id.EncodinggetEncodingForCharset(java.nio.charset.Charset charset)Gets anEncodingfor the specified Java character set.EncodinggetEncodingForCharset(java.nio.charset.Charset charset, Encoding fallbackEncoding)Gets anEncodingfor the specified Java character set.EncodinggetEncodingForCharsetAlias(java.lang.String charsetAlias)Gets anEncodingfor the specified Java character set name or alias.EncodinggetEncodingForFirebirdName(java.lang.String firebirdEncodingName)Gets anEncodingfor the specified Firebird encoding.<T extends DatatypeCoder>
 TgetOrCreateDatatypeCoder(java.lang.Class<T> datatypeCoderClass)Gets or - if necessary - creates a datatype coder of the specified type.EncodinggetOrCreateEncodingForCharset(java.nio.charset.Charset charset)Creates anEncodingfor the specified Java character set.IEncodingFactorywithDefaultEncodingDefinition(java.nio.charset.Charset charset)IEncodingFactorywithDefaultEncodingDefinition(EncodingDefinition encodingDefinition)Returns anIEncodingFactorythat usesencodingDefinitionas the default.
 
- 
- 
- 
Method Detail- 
getDefaultEncodingEncoding getDefaultEncoding() - Returns:
- The EncodingforCharset.defaultCharset().
 
 - 
getDefaultEncodingDefinitionEncodingDefinition getDefaultEncodingDefinition() Returns theEncodingDefinitionfor 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".- Returns:
- The EncodingDefinitionforCharset.defaultCharset().
 
 - 
getEncodingDefinitionByFirebirdNameEncodingDefinition getEncodingDefinitionByFirebirdName(java.lang.String firebirdEncodingName) Looks up theEncodingDefinitionfor the specified Firebird encoding name.- Parameters:
- firebirdEncodingName- The Firebird encoding name (case insensitive)
- Returns:
- EncodingDefinition instance or nullif the encoding name is unknown
 
 - 
getEncodingForFirebirdNameEncoding getEncodingForFirebirdName(java.lang.String firebirdEncodingName) Gets anEncodingfor 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.- Parameters:
- firebirdEncodingName- The Firebird encoding name (case insensitive)
- Returns:
- Encoding instance (never null)
 
 - 
getEncodingDefinitionByCharacterSetIdEncodingDefinition getEncodingDefinitionByCharacterSetId(int firebirdCharacterSetId) Looks up theEncodingDefinitionfor the specified Firebird character set id.Implementations that do not know the connection character set should return nullfor the valueISCConstants.CS_dynamic(= 127), as that is the indicator to use the connection character set.- Parameters:
- firebirdCharacterSetId- Firebird character set id
- Returns:
- EncodingDefinition instance or nullif the character set id is unknown or127and this implementation doesn't know the connection character set.
 
 - 
getEncodingForCharacterSetIdEncoding getEncodingForCharacterSetId(int firebirdCharacterSetId) Gets anEncodingfor the specified Firebird character set id. If there is no known encoding for this character set id (or if it is 127, seegetEncodingDefinitionByCharacterSetId(int)), or the loaded EncodingDefinition is information-only, then the defaultEncoding will be used.- Parameters:
- firebirdCharacterSetId- The Firebird character set id
- Returns:
- Encoding instance (never null)
 
 - 
getEncodingDefinitionByCharsetEncodingDefinition getEncodingDefinitionByCharset(java.nio.charset.Charset charset) Looks up anEncodingDefinitionfor the JavaCharset.- Parameters:
- charset- The Java character set
- Returns:
- EncodingDefinition instance or nullif the character set is not mapped
 
 - 
getEncodingForCharsetEncoding getEncodingForCharset(java.nio.charset.Charset charset, Encoding fallbackEncoding) Gets anEncodingfor the specified Java character set. If there is no known encoding for thisCharset, or the loaded EncodingDefinition is information-only, then the fallbackEncoding will be used.- Parameters:
- charset- The Java character set
- fallbackEncoding- The Encoding to use as fallback if no encoding is found (usually the connection encoding). If- null, the defaultEncoding for the JVM is used.
- Returns:
- Encoding instance (never null)
- See Also:
- getOrCreateEncodingForCharset(java.nio.charset.Charset)
 
 - 
getEncodingForCharsetEncoding getEncodingForCharset(java.nio.charset.Charset charset) Gets anEncodingfor the specified Java character set. If there is no known encoding for thisCharset, or the loaded EncodingDefinition is information-only, then the defaultEncoding will be used.- Parameters:
- charset- The Java character set
- Returns:
- Encoding instance (never null)
 
 - 
getOrCreateEncodingForCharsetEncoding getOrCreateEncodingForCharset(java.nio.charset.Charset charset) Creates anEncodingfor 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.- Parameters:
- charset- The Java character set
- Returns:
- Encoding instance (never null)
- See Also:
- getEncodingForCharset(java.nio.charset.Charset, Encoding)
 
 - 
getEncodingDefinitionByCharsetAliasEncodingDefinition getEncodingDefinitionByCharsetAlias(java.lang.String charsetAlias) Looks up theEncodingDefinitionby the specified Java character set name or alias.- Parameters:
- charsetAlias- Name (or alias) of the Java character set (case insensitive)
- Returns:
- EncodingDefinition instance or nullif the character set name is not mapped
 
 - 
getEncodingForCharsetAliasEncoding getEncodingForCharsetAlias(java.lang.String charsetAlias) Gets anEncodingfor 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.- Parameters:
- charsetAlias- The Java character set name or alias
- Returns:
- Encoding instance (never null)
 
 - 
getEncodingDefinitionEncodingDefinition getEncodingDefinition(java.lang.String firebirdEncodingName, java.lang.String javaCharsetAlias) Gets or creates anEncodingDefinitionfor the supplied Firebird encoding and Java charset.When firebirdEncodingNameis not null andjavaCharsetAliasis null, then the encoding definition as returned bygetEncodingDefinitionByFirebirdName(String)is returned. For the reverse (firebirdEncodingNameis null andjavaCharsetAliasisn't), the encoding definition as returned bygetEncodingDefinitionByCharsetAlias(String)is returned.When both parameters are set, the result of getEncodingDefinitionByFirebirdName(String)is returned if the character set matches, otherwise a newDefaultEncodingDefinitionis 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.- Parameters:
- firebirdEncodingName- Name of the Firebird encoding, or null to defer decision to the java Charset alias
- javaCharsetAlias- Alias of the Java character set, or null to defer decision to the Firebird encoding
- Returns:
- An EncodingDefinition or null if both parameters are null, no encoding was found or if an exception occurred.
 
 - 
withDefaultEncodingDefinitionIEncodingFactory withDefaultEncodingDefinition(EncodingDefinition encodingDefinition) Returns anIEncodingFactorythat usesencodingDefinitionas the default.- Parameters:
- encodingDefinition- The default encoding to use (or- nullfor the value of- getDefaultEncoding()
- Returns:
- IEncodingFactory instance with the specified default.
 
 - 
withDefaultEncodingDefinitionIEncodingFactory withDefaultEncodingDefinition(java.nio.charset.Charset charset) - Parameters:
- charset- The default charset to use.
- Returns:
- IEncodingFactory instance with the specified default.
 
 - 
getOrCreateDatatypeCoder<T extends DatatypeCoder> T getOrCreateDatatypeCoder(java.lang.Class<T> datatypeCoderClass) Gets or - if necessary - creates a datatype coder of the specified type.In general this method should only be called from a static factory method on the datatype coder itself. - Type Parameters:
- T- Type parameter of type- DatatypeCoder
- Parameters:
- datatypeCoderClass- Type of datatype coder, needs to have a single-arg constructor accepting an- IEncodingFactory.
- Returns:
- New or cached instance of datatype coder
 
 
- 
 
-