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

        while (numRead < (buffer.length - 260)) { // && i != 128) {
            int i = in.read();
            if (i < 0)
                break;
            if (i < 128) {
                numRead += fillBufferFromInputStream(numRead, i + 1);
            } else {
                int count = (257 - i);
                int j = in.read();
                byte jj = (byte) (j & 0xFF);
                for (int k = 0; k < count; k++) {
                    buffer[numRead++] = jj;
                }
            }
        }

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