Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the hidden size limitation of String serialization?

0
Posted

Whats the hidden size limitation of String serialization?

0

[*] If you wish to Serialize a string, be alert to the restriction that: The size of the String, when UTF-encoded, must be < 64Kb So for robust code you have to examine the String once to ensure that it will be less than 64Kb after encoding, and then have the JVM effectively repeat that work in the process of encoding, when you write it to an ObjectOutputStream. A possible workaround that is to strip the string down to "byte[]" and pass it around in RMI that way. The code with this restriction is in DataOutputStream public final void writeUTF(String str) ... [perform the size-after-conversion-to-UTF computation] ... if (utflen > 65535) throw new UTFDataFormatException(); … RMI relies on serialization, so RMI has the same String size limitation. 21. (Sect. 19) When I change a field in just one object in my array, that field changes in all the objects in my array! [*] Here the problem is probably that you have initialized the array with N references to the same one object. This is easy

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123