Module com.sun.xml.messaging.saaj
Class ASCIIUtility
java.lang.Object
com.sun.xml.messaging.saaj.packaging.mime.util.ASCIIUtility
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static byte[]
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.
-
Method Details
-
parseInt
Convert the bytes within the specified range of the given byte array into a signed integer in the given radix . The range extends fromstart
till, but not includingend
. Based on java.lang.Integer.parseInt().- Parameters:
b
- bytes to convert to integer.start
- start of the range.end
- end of the range (not including).radix
- radix.- Returns:
- integer.
- Throws:
NumberFormatException
-
toString
Convert the bytes within the specified range of the given byte array into a String. The range extends fromstart
till, but not includingend
.- Parameters:
b
- bytes to convert to integer.start
- start of the range.end
- end of the range (not including).- Returns:
- integer.
-
getBytes
Encodes specified String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.- Parameters:
s
- string to encode into byte array.- Returns:
- byte array.
-
getBytes
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. UseByteOutputStream
andByteOutputStream.write(InputStream)
.Converts input stream to array.- Parameters:
is
- stream to convert to array.- Returns:
- byte array.
- Throws:
IOException
- if an I/O error occurs.
-