Fixed utf serialization for substrings. On jdk6 substrings share the sam...

...e value array with original string. Accessing internal array directly using unsafe or reflection causes wrong data to be written. Additionally refactored internal classes to avoid creating junk objects.

Fixes #3652 
Fixes #3653