Package com.iizix.codepage
Class CodepageConverter
- java.lang.Object
- com.iizix.codepage.CodepageConverter
public class CodepageConverter extends java.lang.Object
The class is the actual "doer" for the CodepageMapper class.- Author:
- Christopher Mindus
- See Also:
CodepageMapper
Constructor Summary
Constructors Constructor Description CodepageConverter(int[] map, java.lang.String codepageName)
Creates an instance and sets the available codepage.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char
convertByteToChar(byte b)
Converts a single byte to character.char[]
convertByteToChar(byte[] b)
Converts an array of bytes to an array of characters.char[]
convertByteToChar(byte[] b, int offset, int length)
Converts an array of bytes to an array of characters.java.lang.String
convertByteToString(byte[] b)
Converts an array of bytes to a string.java.lang.String
convertByteToString(byte[] b, int offset, int length)
Converts an array of bytes to a string.byte
convertCharToByte(char c)
Converts a single character to byte.byte[]
convertCharToByte(char[] c)
Converts an array of characters to an array of bytes.byte[]
convertStringToByte(java.lang.String s)
Converts a string to an array of bytes.static CodepageConverter
createCodepageConverter(int[] map)
Creates an instance and sets the available codepage.static CodepageConverter
createCodepageConverter(int[] map, java.lang.String codepageName)
Creates an instance and sets the available codepage.static CodepageConverter
createCodepageConverter(java.lang.String codepageName)
Creates an instance of a codepage short name.java.lang.String
getCodePage()
Gets the current codepage short name.int
getCodePageValue()
Gets the current (EBCDIC) code page value, e.g.
Method Detail
createCodepageConverter
public static CodepageConverter createCodepageConverter(int[] map)
Creates an instance and sets the available codepage.
createCodepageConverter
public static CodepageConverter createCodepageConverter(int[] map, java.lang.String codepageName)
Creates an instance and sets the available codepage.
createCodepageConverter
public static CodepageConverter createCodepageConverter(java.lang.String codepageName)
Creates an instance of a codepage short name. This codepage short name must be a class implementing theCodepageMapInterface
class in the same package as this class.- Returns:
- null if the codepage cannot be created.
getCodePage
public java.lang.String getCodePage()
Gets the current codepage short name.
getCodePageValue
public int getCodePageValue()
Gets the current (EBCDIC) code page value, e.g. 37, 278, 500...
convertByteToChar
public char convertByteToChar(byte b)
Converts a single byte to character.
convertByteToChar
public char[] convertByteToChar(byte[] b)
Converts an array of bytes to an array of characters.
convertByteToChar
public char[] convertByteToChar(byte[] b, int offset, int length)
Converts an array of bytes to an array of characters.
convertByteToString
public java.lang.String convertByteToString(byte[] b)
Converts an array of bytes to a string.
convertByteToString
public java.lang.String convertByteToString(byte[] b, int offset, int length)
Converts an array of bytes to a string.
convertCharToByte
public byte convertCharToByte(char c)
Converts a single character to byte.
convertCharToByte
public byte[] convertCharToByte(char[] c)
Converts an array of characters to an array of bytes.
convertStringToByte
public byte[] convertStringToByte(java.lang.String s)
Converts a string to an array of bytes.