git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352124
13f79535-47bb-0310-9956-
ffa450edef68
{
field_1_footer_len = data[ 0 + offset ];
field_2_footer = new String(data, 1 + offset,
- ( int ) field_1_footer_len);
+ LittleEndian.ubyteToInt( field_1_footer_len) );
}
}
{
field_1_header_len = data[ 0 + offset ];
field_2_header = new String(data, 1 + offset,
- ( int ) field_1_header_len);
+ LittleEndian.ubyteToInt(field_1_header_len));
}
}
v >>= 8;
}
}
+
+ /**
+ * Convert an 'unsigned' byte to an integer. ie, don't carry across the sign.
+ */
+ public static int ubyteToInt(byte b)
+ {
+ return ((b & 0x80) == 0 ? (int)b : (int)(b & (byte)0x7f) + 0x80 );
+ }
}