ObjectOutputStream methods: writeBytes(String str) vs writeUTF(String s);
问题 What's the main difference between the two? Still both of them are for writing Strings. public void writeUTF(String str) throws IOException Primitive data write of this String in modified UTF-8 format. vs public void writeBytes(String str) throws IOException Writes a String as a sequence of bytes. When should I use one rather than the other? 回答1: It's in the documentation... from DataOutput.writeBytes(String): Writes a string to the output stream. For every character in the string s, taken in