I am writing a socket programming application, and I'm wondering about DataOutputStream
.
I have two questions:
What is the default encoding for bytes sent from DataOutputStream
?
What is the max size of a String
that OutputStream.writeBytes(String s)
can send? Is it
possible for the stream to truncate the String (and therefore be buggy)?
Before talking about encoding in DataOutputStream, you need to say which method you are talking about:
In each case, the answer can be gleaned from looking at the javadoc:
UTF-16HE
.modified UTF-8
encoding.To answer your second question, the only maximums on the string size that can be stored will be memory, otherwise you can't store the string, and free disk space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With