DataOutputStream dos = new DataOutputStream(bos);
String s = "abcdefghijklmnopqrstuvwxyz";
SafeUTF su = new SafeUTF(30);
su.safeWriteUTF(dos, s);
dos.close();
byte[] bytes = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
DataInputStream dis = new DataInputStream(bis);
String s2 = su.safeReadUTF(dis);
assertEquals(s, s2);
int lastReadBufferSize = su.getLastReadBufferSize();
assertEquals(28, lastReadBufferSize);
}