I wanted to use DataOutputStream # writeBytes , but ran into errors. Description writeBytes(String)from Java documentation:
writeBytes(String)
Writes a string to the underlying output stream as a sequence of bytes. Each character in the string is written out sequentially, discarding its high eight bits.
I think the problem I am having is that it is "dropping its high eight bits". What does this mean and why does it work?
ASCII, , Java String - 16- Unicode. writeBytes , ASCII/ISO-8859-1 "" C.
String
writeBytes
char - Unicode 16-bit. '\u0000' ( 0) '\uffff' ( 65,535 ). byte - 8-bit, . -128 127 (). char . . , , , 0 255.
char
16-bit
'\u0000'
'\uffff'
65,535
byte
8-bit
-128
127
0
255
writeUTF(String s), , . 2- int 0 65,535. UTF-8 . , , .
writeUTF(String s)
UTF-8