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

Re: 20050114: Bug? in ucar.unidata.io.RandomAccessFile NetCDF for Java



Hi Steve:

Unidata Support wrote:

To: address@hidden
From: "Stephen P. Cerruti" <address@hidden>
Subject: Bug? in ucar.unidata.io.RandomAccessFile NetCDF for Java
Organization: Keywords: 200501141454.j0EEsxv2011929

I am using ucar.unidata.io.RandomAccessFile in another application to speed processing of some corrupted tiff files.

I discovered that when writing out large chunks of data when the buffer was unmodified the file pointer was not in the correct position.

580c580,581
<            bufferStart = dataEnd = dataSize = 0;
---
>            bufferStart = dataEnd = dataSize = 0;
>            file.seek(filePosition); // JC added Oct 21, 2004
582,583d582
<          file.seek(filePosition); // JC added Oct 21, 2004
<
Im not sure what you are diffing here? The 2 look identical. Is the above code incorrect?

Also, and I don't know if this was intentional, but ReadUnsignedShort is not swapping bytes.

737,740c736
<       if (bigEndian)
<         return (short)((ch1 << 8) + (ch2 << 0));
<       else
<         return (short)((ch2 << 8) + (ch1 << 0));
---
>       return (ch1 << 8) + (ch2 << 0);
thanks, that was inadvertant; ill add in your fix

Thanks for the class.
youre welcome, thanks for your feedback