forked from I2P_Developers/i2p.i2p
handle the UnsignedInteger's new "IllegalArgumentException on negative" policy
This commit is contained in:
@ -221,8 +221,12 @@ public class DataHelper {
|
|||||||
*/
|
*/
|
||||||
public static void writeLong(OutputStream rawStream, int numBytes, long value)
|
public static void writeLong(OutputStream rawStream, int numBytes, long value)
|
||||||
throws DataFormatException, IOException {
|
throws DataFormatException, IOException {
|
||||||
UnsignedInteger i = new UnsignedInteger(value);
|
try {
|
||||||
rawStream.write(i.getBytes(numBytes));
|
UnsignedInteger i = new UnsignedInteger(value);
|
||||||
|
rawStream.write(i.getBytes(numBytes));
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
throw new DataFormatException("Invalid value (must be positive)", iae);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read in a date from the stream as specified by the I2P data structure spec.
|
/** Read in a date from the stream as specified by the I2P data structure spec.
|
||||||
|
Reference in New Issue
Block a user