protected int fillInternalBuffer() throws IOException {
        int numRead = 0;

        for (int i = 0; i < buffer.length; i++) {
            byte val = 0;
            int hi;
            int lo;
            do {
                hi = in.read();
            } while (Parser.isWhitespace((char) hi));
            if (hi < 0)
                break;
            do {
                lo = in.read();
            } while (Parser.isWhitespace((char) lo));

            if (hi >= '0' && hi <= '9') {
                hi -= '0';
                val |= ((byte) ((hi << 4) & 0xF0));
            } else if (hi >= 'a' && hi <= 'z') {
                hi = hi - 'a' + 10;
                val |= ((byte) ((hi << 4) & 0xF0));
            } else if (hi >= 'A' && hi <= 'Z') {
                hi = hi - 'A' + 10;
                val |= ((byte) ((hi << 4) & 0xF0));
            }

            if (lo >= 0) {
                if (lo >= '0' && lo <= '9') {
                    lo -= '0';
                    val |= ((byte) (lo & 0x0F));
                } else if (lo >= 'a' && lo <= 'z') {
                    lo = lo - 'a' + 10;
                    val |= ((byte) (lo & 0x0F));
                } else if (lo >= 'A' && lo <= 'Z') {
                    lo = lo - 'A' + 10;
                    val |= ((byte) (lo & 0x0F));
                }
            }
            buffer[numRead++] = val;
        }

        if (numRead == 0)
            return -1;
        return numRead;
    }