Updated JSONParser to read from a stream

This commit is contained in:
Ziver Koc 2013-06-09 00:00:00 +00:00
parent 22adf3b7f2
commit 1a7f0fd1d9
3 changed files with 102 additions and 84 deletions

View file

@ -61,9 +61,12 @@ public class StringInputStream extends InputStream{
* Reads the next byte of data from the input stream.
*/
public int read(){
int ret = Character.getNumericValue( buffer.charAt( 0 ));
buffer.deleteCharAt( 0 );
return ret;
if(buffer.length() > 0){
int ret = Character.getNumericValue( buffer.charAt( 0 ));
buffer.deleteCharAt( 0 );
return ret;
}
return -1;
}
/**