Reputation: 2591
How can I simply write big-endian typed data into an OutputStream and still use buffering? (I'm developing for android if it makes any difference)
I tried
out = new BufferedWriter(new DataOutputStream(new OutputStreamWriter(sock.getOutputStream())));
but it looks like I'm in no luck, because this cannot be done. I'm new to Java.
Upvotes: 0
Views: 1494
Reputation: 691943
Writers are used to write characters (text). Streams are used to write bytes (binary).
You can wrap a Stream with a Writer, but not the reverse.
If you want binary data and buffering, use a BufferedOutputStream.
Upvotes: 4