All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.sdk.json.CharReader Maven / Gradle / Ivy

There is a newer version: 1.5.17
Show newest version
package org.zodiac.sdk.json;

import org.zodiac.sdk.json.constants.JSONConstants;

public class CharReader {

    private String chars;
    private int _length;
    private int _next = 0;
    private char _val;

    public CharReader(String s) {
        this.chars  = s;
        this._length = s.length();
    }

    public boolean read() {
        if (_next >= _length) {
            return false;
        }else {
            _val = chars.charAt(_next++);
            return true;
        }
    }

    public char next(){
        if(read()){
            return _val;
        }else {
            return JSONConstants.EOI;
        }
    }

    public int length(){
        return _length;
    }

    public char value(){
        return _val;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy