public class HexDump extends ObjectDumps data in hexadecimal format.
Provides a single function to take an array of bytes and display it in hexadecimal form.
Origin of code: POI.
Constructors Constructor and Description
HexDump()Instances should NOT be constructed in standard programming.
All Methods Static Methods Concrete Methods Modifier and Type Method and Description
dump(byte data, long offset, OutputStream stream, int index)Dump an array of bytes to an OutputStream.
public static final String EOLThe line-separator (initializes to "line.separator" system property.
public HexDump()Instances should NOT be constructed in standard programming.
public static void dump(byte data, long offset, OutputStream stream, int index) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentExceptionDump an array of bytes to an OutputStream. The output is formatted for human inspection, with a hexadecimal offset followed by the hexadecimal values of the next 16 bytes of data and the printable ASCII characters (if any) that those bytes represent printed per each line of output.
The offset argument specifies the start offset of the data array within a larger entity like a file or an incoming stream. For example, if the data array contains the third kibibyte of a file, then the offset argument should be set to 2048. The offset value printed at the beginning of each line indicates where in that larger entity the first byte on that line is located.
All bytes between the given index (inclusive) and the end of the data array are dumped.
data- the byte array to be dumped
offset- offset of the byte array within a larger entity
stream- the OutputStream to which the data is to be written
index- initial index into the byte array
IOException- is thrown if anything goes wrong writing the data to stream
ArrayIndexOutOfBoundsException- if the index is outside the data array's bounds
IllegalArgumentException- if the output stream is null
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.