view src/goodjava/io/DataOutputStream.java @ 1518:f989778ca9e1

stringify, json_string
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 19 Jun 2020 17:50:25 -0600
parents aaac1d29edea
children
line wrap: on
line source

package goodjava.io;

import java.io.OutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;


public class DataOutputStream extends java.io.DataOutputStream {

	public DataOutputStream(OutputStream out) {
		super(out);
	}

	public void writeString(String s) throws IOException {
		byte[] a = s.getBytes(StandardCharsets.UTF_8);
		writeInt(a.length);
		write(a);
	}
}