private Character readNextCharacter() {
        if (putback == null && buffer.isEmpty())
            return null;
        else if (putback == null)
            return buffer.removeFirst();
        else {
            Character temp = putback;
            putback = null;
            return temp;
        }
    }