[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-user
Subject:    Re: [Fileupload] (SOLVED) Missing character in the middle of a file
From:       Brian Pontarelli <brian () pontarelli ! com>
Date:       2010-10-14 17:40:19
Message-ID: 373E319D-4A34-4B69-826B-E84A0B45674F () pontarelli ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic