public final class HexUtil extends Object
Modifier and Type | Field and Description |
---|---|
static char[] |
DIGITS |
Modifier and Type | Method and Description |
---|---|
static void |
appendHex(StringBuilder builder,
int b)
Deprecated.
|
static String |
bytesToHex(byte[] bs) |
static String |
bytesToHex(byte[] bs,
int off,
int length)
Converts a byte array into a string of lower case hex chars.
|
static void |
bytesToHex(InputStream bs,
Writer writer) |
static void |
bytesToHexAppend(byte[] bs,
int off,
int length,
Appendable appendable) |
static String |
formatByte(int b)
Deprecated.
|
static String |
formatBytes(byte[] bytes)
Deprecated.
|
static void |
hexToBytes(Reader s,
OutputStream outputStream) |
static byte[] |
hexToBytes(String s) |
static void |
hexToBytes(String s,
byte[] out,
int off)
Converts a String of hex characters into an array of bytes.
|
static byte[] |
hexToBytes(String s,
int off) |
static String |
longToHex(long v) |
public static String bytesToHex(byte[] bs, int off, int length)
bs
- A byte arrayoff
- The index of the first byte to readlength
- The number of bytes to read.public static void bytesToHexAppend(byte[] bs, int off, int length, Appendable appendable)
public static void bytesToHex(InputStream bs, Writer writer)
public static String bytesToHex(byte[] bs)
public static byte[] hexToBytes(String s)
public static byte[] hexToBytes(String s, int off)
public static void hexToBytes(String s, byte[] out, int off) throws NumberFormatException, IndexOutOfBoundsException
s
- A string of hex characters (upper case or lower) of even length.out
- A byte array of length at least s.length()/2 + offoff
- The first byte to write of the arrayNumberFormatException
IndexOutOfBoundsException
public static void hexToBytes(Reader s, OutputStream outputStream) throws NumberFormatException
NumberFormatException
public static String longToHex(long v)
@Deprecated public static String formatByte(int b)
@Deprecated public static String formatBytes(byte[] bytes)
@Deprecated public static void appendHex(StringBuilder builder, int b)
Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html