Package org.apache.poi.util
Class HexDump
- java.lang.Object
 - 
- org.apache.poi.util.HexDump
 
 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbyteToHex(int value)static Stringdump(byte[] data, long offset, int index)dump an array of bytes to a Stringstatic Stringdump(byte[] data, long offset, int index, int length)dump an array of bytes to a Stringstatic voiddump(byte[] data, long offset, OutputStream stream, int index)dump an array of bytes to an OutputStreamstatic voiddump(byte[] data, long offset, OutputStream stream, int index, int length)dump an array of bytes to an OutputStreamstatic StringintToHex(int value)static StringlongToHex(long value)static StringshortToHex(int value)static chartoAscii(int dataB)static StringtoHex(byte value)Converts the parameter to a hex value.static StringtoHex(byte[] value)Converts the parameter to a hex value.static StringtoHex(int value)Converts the parameter to a hex value.static StringtoHex(long value)Converts the parameter to a hex value.static StringtoHex(short value)Converts the parameter to a hex value. 
 - 
 
- 
- 
Method Detail
- 
dump
public static void dump(byte[] data, long offset, OutputStream stream, int index, int length) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentExceptiondump an array of bytes to an OutputStream- Parameters:
 data- the byte array to be dumpedoffset- its offset, whatever that might meanstream- the OutputStream to which the data is to be writtenindex- initial index into the byte arraylength- number of characters to output- Throws:
 IOException- is thrown if anything goes wrong writing the data to streamArrayIndexOutOfBoundsException- if the index is outside the data array's boundsIllegalArgumentException- if the output stream is null
 
- 
dump
public static void dump(byte[] data, long offset, OutputStream stream, int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentExceptiondump an array of bytes to an OutputStream- Parameters:
 data- the byte array to be dumpedoffset- its offset, whatever that might meanstream- the OutputStream to which the data is to be writtenindex- initial index into the byte array- Throws:
 IOException- is thrown if anything goes wrong writing the data to streamArrayIndexOutOfBoundsException- if the index is outside the data array's boundsIllegalArgumentException- if the output stream is null
 
- 
dump
public static String dump(byte[] data, long offset, int index)
dump an array of bytes to a String- Parameters:
 data- the byte array to be dumpedoffset- its offset, whatever that might meanindex- initial index into the byte array- Returns:
 - output string
 - Throws:
 ArrayIndexOutOfBoundsException- if the index is outside the data array's bounds
 
- 
dump
public static String dump(byte[] data, long offset, int index, int length)
dump an array of bytes to a String- Parameters:
 data- the byte array to be dumpedoffset- its offset, whatever that might meanindex- initial index into the byte arraylength- number of characters to output- Returns:
 - output string
 - Throws:
 ArrayIndexOutOfBoundsException- if the index is outside the data array's bounds
 
- 
toAscii
public static char toAscii(int dataB)
 
- 
toHex
public static String toHex(byte[] value)
Converts the parameter to a hex value.- Parameters:
 value- The value to convert- Returns:
 - A String representing the array of bytes
 
 
- 
toHex
public static String toHex(short value)
Converts the parameter to a hex value.- Parameters:
 value- The value to convert- Returns:
 - The result right padded with 0
 
 
- 
toHex
public static String toHex(byte value)
Converts the parameter to a hex value.- Parameters:
 value- The value to convert- Returns:
 - The result right padded with 0
 
 
- 
toHex
public static String toHex(int value)
Converts the parameter to a hex value.- Parameters:
 value- The value to convert- Returns:
 - The result right padded with 0
 
 
- 
toHex
public static String toHex(long value)
Converts the parameter to a hex value.- Parameters:
 value- The value to convert- Returns:
 - The result right padded with 0
 
 
- 
longToHex
public static String longToHex(long value)
- Returns:
 - string of 16 (zero padded) uppercase hex chars and prefixed with '0x'
 
 
- 
intToHex
public static String intToHex(int value)
- Returns:
 - string of 8 (zero padded) uppercase hex chars and prefixed with '0x'
 
 
- 
shortToHex
public static String shortToHex(int value)
- Returns:
 - string of 4 (zero padded) uppercase hex chars and prefixed with '0x'
 
 
- 
byteToHex
public static String byteToHex(int value)
- Returns:
 - string of 2 (zero padded) uppercase hex chars and prefixed with '0x'
 
 
 - 
 
 -