commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pontarelli <br...@pontarelli.com>
Subject Re: [Fileupload] (SOLVED) Missing character in the middle of a file
Date Thu, 14 Oct 2010 17:40:19 GMT
I wanted to close this thread out. I figured out the issue. My stream wasn't correctly converting
the bytes to ints. It needed to shift the bits so that if the byte FF was encountered it wasn't
returned as -1, but as 255. In fact, all negative bytes were probably causing issues. The
fix was to change my read method to this:

    public int read() throws IOException {
        return (index < bytes.length) ? (bytes[index++] & 0xff) : -1;
    }

-bp



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message