After reading this old article measuring the memory consumption of several object types, I was amazed to see how much memory String
s use in Java:
Just compress them all with gzip. :) Just kidding... but I have seen stranger things, and it would give you much smaller data at significant CPU expense.
The only other String implementations that I'm aware of are the ones in the Javolution classes. I don't think that they are more memory efficient, though:
http://www.javolution.com/api/javolution/text/Text.html
http://www.javolution.com/api/javolution/text/TextBuilder.html