List of utility methods to do Byte Array from
byte[] | getBytesInCodePage(final String string, final int codepage) Converts a string into bytes, in the equivalent character encoding to the supplied codepage number. String encoding = codepageToEncoding(codepage);
return string.getBytes(encoding);
|
byte[] | getBytesInUsAscii(String s) Returns the bytes of the string in ENCODING_US_ASCII. try { return s.getBytes(ENCODING_US_ASCII); } catch (UnsupportedEncodingException e) { return s.getBytes(); |
byte[] | getBytesISO88591(String s) get Bytes ISO return getBytes(s, "ISO-8859-1"); |
int | getBytesLengthOfEncoding(String encoding, String str) get Bytes Length Of Encoding if (str == null || str.length() == 0) return 0; try { byte bytes[] = str.getBytes(encoding); int length = bytes.length; return length; } catch (UnsupportedEncodingException exception) { System.err.println(exception.getMessage()); ... |
String | getByteString(RandomAccessFile inputStream, int numBytesToRead) get Byte String byte[] bytes = new byte[numBytesToRead]; try { inputStream.readFully(bytes); } catch (IOException e) { e.printStackTrace(); return new String(bytes); |