- java.lang.Object
-
- com.ibm.dtfj.corereaders.zos.util.CharConversion
-
public class CharConversion extends Object
This class provides some handy character conversion methods
-
-
Constructor Summary
Constructors Constructor Description CharConversion()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getEbcdicBytes(String s)Convert the given String to ebcdic bytesstatic StringgetEbcdicString(byte[] buf)Convert an array of ebcdic bytes to a Stringstatic StringgetEbcdicString(byte[] buf, int offset, int length)Convert an array of ebcdic bytes to a Stringstatic byte[]nullTerminate(byte[] buf)Null terminates the given array.
-
-
-
Method Detail
-
getEbcdicBytes
public static byte[] getEbcdicBytes(String s)
Convert the given String to ebcdic bytes- Parameters:
s- the String to be converted- Returns:
- the ebcdic byte array
-
getEbcdicString
public static String getEbcdicString(byte[] buf, int offset, int length)
Convert an array of ebcdic bytes to a String- Parameters:
buf- the array of ebcdic bytesoffset- the offset within the array where the bytes to be converted startlength- the number of bytes to convert- Returns:
- the converted String
-
getEbcdicString
public static String getEbcdicString(byte[] buf)
Convert an array of ebcdic bytes to a String- Parameters:
buf- the array of ebcdic bytes- Returns:
- the converted String
-
nullTerminate
public static byte[] nullTerminate(byte[] buf)
Null terminates the given array.- Parameters:
buf- the array to be null terminated- Returns:
- a copy of the array but with an extra zero byte at the end
-
-