Package org.daisy.braille.table
Class AdvancedBrailleConverter
- java.lang.Object
-
- org.daisy.braille.table.AdvancedBrailleConverter
-
- All Implemented Interfaces:
BrailleConverter
public class AdvancedBrailleConverter extends java.lang.Object implements BrailleConverter
Provides an advanced Braille converter mapping each braille character to a string.- Author:
- Joel HÃ¥kansson, Bert Frees
-
-
Constructor Summary
Constructors Constructor Description AdvancedBrailleConverter(java.lang.String[] table, java.nio.charset.Charset charset, boolean ignoreCase, StringTranslator.MatchMode mode)Creates a new 8-dot table.AdvancedBrailleConverter(java.lang.String[] table, java.nio.charset.Charset charset, EmbosserBrailleConverter.EightDotFallbackMethod fallback, char replacement, boolean ignoreCase, StringTranslator.MatchMode mode)Creates a new 6-dot table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.charset.CharsetgetPreferredCharset()Gets the preferred charset for this braille format when reading/writing as text from/to filebooleansupportsEightDot()Returns true if 8-dot braille is supported, false otherwisejava.lang.StringtoBraille(java.lang.String text)Transcodes the given text string as braille.java.lang.StringtoText(java.lang.String braille)Transcodes the given braille into text.
-
-
-
Constructor Detail
-
AdvancedBrailleConverter
public AdvancedBrailleConverter(java.lang.String[] table, java.nio.charset.Charset charset, EmbosserBrailleConverter.EightDotFallbackMethod fallback, char replacement, boolean ignoreCase, StringTranslator.MatchMode mode)Creates a new 6-dot table. Each string in the table array represents a braille character. The string at index i in the array is interpreted as the translation for the braille character with Unicode value 0x2800+i.- Parameters:
table- the table data, 64 entriescharset- the preferred charset as defined in the BrailleConverter interfacefallback- the fallback method to use when encountering a character in the range 0x2840-0x28FFreplacement- the replacement character, must be in the range 0x2800-0x283FignoreCase- set to true to ignore character casemode- the match mode to use
-
AdvancedBrailleConverter
public AdvancedBrailleConverter(java.lang.String[] table, java.nio.charset.Charset charset, boolean ignoreCase, StringTranslator.MatchMode mode)Creates a new 8-dot table. Each string in the table array represents a braille character. The string at index i in the array is interpreted as the translation for the braille character with Unicode value 0x2800+i.- Parameters:
table- the table data, 256 entriescharset- the preferred charset as defined in the BrailleConverter interfaceignoreCase- set to true to ignore character casemode- the match mode to use
-
-
Method Detail
-
getPreferredCharset
public java.nio.charset.Charset getPreferredCharset()
Description copied from interface:BrailleConverterGets the preferred charset for this braille format when reading/writing as text from/to file- Specified by:
getPreferredCharsetin interfaceBrailleConverter- Returns:
- returns the preferred charset
-
supportsEightDot
public boolean supportsEightDot()
Description copied from interface:BrailleConverterReturns true if 8-dot braille is supported, false otherwise- Specified by:
supportsEightDotin interfaceBrailleConverter- Returns:
- returns true if 8-dot braille is supported, false otherwise
-
toBraille
public java.lang.String toBraille(java.lang.String text)
Description copied from interface:BrailleConverterTranscodes the given text string as braille. This may be a one-to-one mapping or a many-to-one depending on the table implementation.- Specified by:
toBraillein interfaceBrailleConverter- Returns:
- returns a Unicode string of braille
-
toText
public java.lang.String toText(java.lang.String braille)
Description copied from interface:BrailleConverterTranscodes the given braille into text. In most cases this will reverse the effect of toBraille(String text), i.e. text.equals(toText(toBraille(text))), however an implementation cannot rely on it. Values must be between 0x2800 and 0x28FF.- Specified by:
toTextin interfaceBrailleConverter- Returns:
- returns a text string
-
-