[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File writing error in Cluster.saveShadow



On Wed, 03 Jan 2001, you wrote:
> Hi!
> 
> There is an error in org.ozoneDB.core.wizardStore.Cluster.saveShadow().
> 
> The code is:
> 
>          int c = 0;
>             do {
>                 c = in.read( chunk );
>                 out.write( chunk, 0, c );
>             } while (c == chunkSize);
> 
> If the input file has a length that is dividable by 1024,
> c will be -1 when the last chunk has been read; out.write will
> then throw an IOException.

ok, what about:

            int c = 0;
            while ((c = in.read( chunk )) != -1) {
                out.write( chunk, 0, c );
            }

?


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com