Navigation

Own programs

Snippets

Libraries

Deutsch

AsciiString

The normal Java string class, java.lang.String, uses UTF-16. That means that the usual java string supports many many more characters than just the 127 from ASCII.
But this doesn't come without costs.. The cost of an additional byte per character. If you have to read a large text file of which you know that it only contains ASCII, you waste RAM and risc an java.lang.OutOfMemoryError. This class implements the java string, but using ASCII and not UTF-16. Because I used the original string class to make this, it can be used in the exact same way.

You can get it here: AsciiString.java, JavaDoc: AsciiString JavaDoc

Be careful, I did not test it extensively (sp?)