This class is the main entry point to the hyphenation package.
You can use only the static methods or create an instance.
getFopHyphenationTree
public static HyphenationTree getFopHyphenationTree(String key)
Returns a hyphenation tree. This method looks in the resources (getResourceStream) for
the hyphenation patterns.
key
- the language/country key
- the hyphenation tree or null if it wasn't found in the resources
getHyphenationTree
public static HyphenationTree getHyphenationTree(String lang,
String country)
Returns a hyphenation tree for a given language and country. The hyphenation trees are
cached.
lang
- the languagecountry
- the country (may be null or "none")
getHyphenationTree
public static HyphenationTree getHyphenationTree(String lang,
String country,
HyphenationTreeResolver resolver)
Returns a hyphenation tree for a given language and country. The hyphenation trees are
cached.
lang
- the languagecountry
- the country (may be null or "none")resolver
- resolver to find the hyphenation files
getHyphenationTreeCache
public static HyphenationTreeCache getHyphenationTreeCache()
- the default (static) hyphenation tree cache
getUserHyphenationTree
public static HyphenationTree getUserHyphenationTree(String key,
String hyphenDir)
Load tree from serialized file or xml file
using configuration settings
key
- language key for the requested hyphenation filehyphenDir
- base directory to find hyphenation files in
- the requested HypenationTree or null if it is not available
getUserHyphenationTree
public static HyphenationTree getUserHyphenationTree(String key,
HyphenationTreeResolver resolver)
Load tree from serialized file or xml file
using configuration settings
key
- language key for the requested hyphenation fileresolver
- resolver to find the hyphenation files
- the requested HypenationTree or null if it is not available
hyphenate
public Hyphenation hyphenate(String word)
Hyphenates a word.
word
- the word to hyphenate
hyphenate
public static Hyphenation hyphenate(String lang,
String country,
String word,
int leftMin,
int rightMin)
Hyphenates a word.
lang
- the languagecountry
- the optional country code (may be null or "none")word
- the word to hyphenateleftMin
- the minimum number of characters before the hyphenation pointrightMin
- the minimum number of characters after the hyphenation point
hyphenate
public static Hyphenation hyphenate(String lang,
String country,
char[] word,
int offset,
int len,
int leftMin,
int rightMin)
Hyphenates a word.
lang
- the languagecountry
- the optional country code (may be null or "none")word
- the word to hyphenateoffset
- the offset of the first character in the "word" character arraylen
- the length of the wordleftMin
- the minimum number of characters before the hyphenation pointrightMin
- the minimum number of characters after the hyphenation point
hyphenate
public static Hyphenation hyphenate(String lang,
String country,
HyphenationTreeResolver resolver,
String word,
int leftMin,
int rightMin)
Hyphenates a word.
lang
- the languagecountry
- the optional country code (may be null or "none")resolver
- resolver to find the hyphenation filesword
- the word to hyphenateleftMin
- the minimum number of characters before the hyphenation pointrightMin
- the minimum number of characters after the hyphenation point
hyphenate
public static Hyphenation hyphenate(String lang,
String country,
HyphenationTreeResolver resolver,
char[] word,
int offset,
int len,
int leftMin,
int rightMin)
Hyphenates a word.
lang
- the languagecountry
- the optional country code (may be null or "none")resolver
- resolver to find the hyphenation filesword
- the word to hyphenateoffset
- the offset of the first character in the "word" character arraylen
- the length of the wordleftMin
- the minimum number of characters before the hyphenation pointrightMin
- the minimum number of characters after the hyphenation point
hyphenate
public Hyphenation hyphenate(char[] word,
int offset,
int len)
Hyphenates a word.
word
- the word to hyphenateoffset
- the offset of the first character in the "word" character arraylen
- the length of the word
setLanguage
public void setLanguage(String lang,
String country)
Sets the language and country for the hyphenation process.
lang
- the languagecountry
- the country (may be null or "none")
setMinPushCharCount
public void setMinPushCharCount(int min)
Sets the minimum number of characters after the hyphenation point
min
- the number of characters
setMinRemainCharCount
public void setMinRemainCharCount(int min)
Sets the minimum number of characters before the hyphenation point
min
- the number of characters