Code example for DataOutputStream

Methods: flushwriteUTF

0
public class ScratchTests { 
	 
	@Test 
	public void testStringCoding() throws IOException { 
		ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
		DataOutputStream dos = new DataOutputStream(byteOut);
		dos.writeUTF("Albin");
		dos.flush();
		byte[] data = byteOut.toByteArray();
		System.out.println(FormatUtil.dumpByteArray(data));
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE