Files greater than the max integer value can not always be extracted with
the code as it currently is.
This is due to the fact that the fullUnpackSize gets an incorrect value.
Note that in this case the value for fullPackSize is likely also wrong.
I fixed this by creating the following method in Raw.java :
* Read a long value from the byte array by combining the low and high
bytes
* (little Endian)
* @param array the array to read from
* @param pos1 the offset of the low bytes
* @param pos2 the offset of the high bytes
*/
public static final long readCombinedLongLittleEndian(byte[] array, int
pos1, int pos2) {
long temp = 0;
temp |= array[pos2+3]&0xff;
temp <<=8;
temp |= array[pos2+2]&0xff;
temp <<=8;
temp |= array[pos2+1]&0xff;
temp <<=8;
temp |= array[pos2]&0xff;
temp <<=8;
temp |= array[pos1+3]&0xff;
temp <<=8;
temp |= array[pos1+2]&0xff;
temp <<=8;
temp |= array[pos1+1]&0xff;
temp <<=8;
temp |= array[pos1]&0xff;
return temp;
}
I make the following change in FileHeader.java here:
if (isLargeBlock()) {
highPackSize =Raw.readIntLittleEndian(fileHeader, position);
position+=4;
highUnpackSize = Raw.readIntLittleEndian(fileHeader, position);
fullUnpackSize=Raw.readCombinedLongLittleEndian(fileHeader, 0,
position);
position+=4;
} else {
highPackSize = 0;
highUnpackSize = 0;
if (unpSize == 0xffffffff) {
unpSize = 0xffffffff;
highUnpackSize = Integer.MAX_VALUE;
}
fullUnpackSize |= highUnpackSize;
fullUnpackSize <<= 32;
fullUnpackSize |= unpSize;
}
// remove the assignment of fullUnpackSize that came after this part.
It will be more difficult for a similar fix on fullPackSize because I
believe you will need access to the byte[] array of the BlockHeader, and I
am not sure if there is a good way to access this from inside
FileHeader.java
Nobody/Anonymous
None
None
Public
|
Date: 2009-07-12 20:25 fixed in 0.3 |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2009-07-12 20:25 | edmund_wagner |
| allow_comments | 1 | 2009-07-12 20:25 | edmund_wagner |
| close_date | - | 2009-07-12 20:25 | edmund_wagner |