Read JSON from a CharacterIterator

I just had a pleasant email exchange with someone who is interested in embedding Stringtree JSON in another project. In this particular case, the basic functionality of the JSONReader is fine, but the calling API was not quite aligned with what they need.

So now, as well as reading JSON from a String, you now have the ability to read JSON from a CharacterIterator. This was a neat changes, as Stringtree JSONReader uses a CharacterIterator internally anyway, so the extra method actually does a bit less than the original one.

For “power users”, there is actually an extra method. When JSONReader starts reading from a CharacterIterator it’s not entirely clear whether it should get its first character by calling current() to get a character already read once, or by calling next() to get the next unread character, or by calling first() to get the first character of the sequence. With this in mind I have provided a read(CharacterIterator ci, int start), where start can be JSONReader.START, JSONReader.NEXT, or JSONReader.CURRENT.

This update is available in sourceforge subversion, and will be included in the next release of Stringtree and Stringtree JSON.