public class ASCIIUtility extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytes(InputStream is)
Deprecated.
this is an expensive operation that require an additional
buffer reallocation just to get the array of an exact size.
Unless you absolutely need the exact size array, don't use this.
Use
ByteOutputStream and ByteOutputStream.write(InputStream) . |
static byte[] |
getBytes(String s)
Encodes specified String into a sequence of bytes using the platform's
default charset, storing the result into a new byte array.
|
static int |
parseInt(byte[] b,
int start,
int end,
int radix)
Convert the bytes within the specified range of the given byte
array into a signed integer in the given radix .
|
static String |
toString(byte[] b,
int start,
int end)
Convert the bytes within the specified range of the given byte
array into a String.
|
public static int parseInt(byte[] b, int start, int end, int radix) throws NumberFormatException
start
till, but not including end
.
Based on java.lang.Integer.parseInt().b
- bytes to convert to integer.start
- start of the range.end
- end of the range (not including).radix
- radix.NumberFormatException
public static String toString(byte[] b, int start, int end)
start
till, but not including end
.b
- bytes to convert to integer.start
- start of the range.end
- end of the range (not including).public static byte[] getBytes(String s)
s
- string to encode into byte array.@Deprecated public static byte[] getBytes(InputStream is) throws IOException
ByteOutputStream
and ByteOutputStream.write(InputStream)
.is
- stream to convert to array.IOException
- if an I/O error occurs.Copyright © 2021 JBoss by Red Hat. All rights reserved.