Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String ReadUtf8String(DataInputStream stream) {
- try {
- ArrayList<Byte> bytes = new ArrayList<Byte>();
- byte curByte;
- while ((curByte = stream.readByte()) != 0) {
- bytes.add(curByte);
- }
- Byte as_Byte[] = (Byte[]) bytes.toArray();
- byte as_byte[] = new byte[as_Byte.length];
- for (int i = 0; i<as_Byte.length; i++) {
- as_byte[i] = as_Byte[i].byteValue();
- }
- return new String(as_byte, "UTF-8");
- } catch (IOException ex) {
- }
- return null;
- }
Add Comment
Please, Sign In to add comment