Why is UTFDataFormatException thrown by DataOutputStream.writeUTF() when serializing a String?
DataOutputStream.writeUTF() does not support writing out strings larger than 64K. The first two bytes of a UTF string in the stream are the length of the string. If a java.lang.String can be larger than 64K, it needs to be stored in the stream by an alternative method rather than depending on the default method of storing a String in the stream, writeUTF.
Related Questions
- What are the most common reasons for a java.util.MissingResourceException being thrown when using java.util.ResourceBundle.getBundle(String s, Locale locale)?
- Why is HTTP 500 thrown in DDV when the SNMP location or any string contains any reserved (special) characters?
- How many negative points is a thrown interception in Yahoo Fantasy Football?