Reputation: 1897
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)?
Upvotes: 4
Views: 5684
Reputation: 29149
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.
Upvotes: 7