/// <exception cref="System.IO.IOException"/> public static void TestReadInRange(long val, int lower, int upper, bool expectSuccess ) { DataOutputBuffer buf = new DataOutputBuffer(); DataInputBuffer inbuf = new DataInputBuffer(); WritableUtils.WriteVLong(buf, val); try { inbuf.Reset(buf.GetData(), 0, buf.GetLength()); long val2 = WritableUtils.ReadVIntInRange(inbuf, lower, upper); if (!expectSuccess) { Fail("expected readVIntInRange to throw an exception"); } Assert.Equal(val, val2); } catch (IOException e) { if (expectSuccess) { Log.Error("unexpected exception:", e); Fail("readVIntInRange threw an unexpected exception"); } } }
/// <exception cref="System.IO.IOException"/> public virtual void Write(BinaryWriter writer) { WritableUtils.WriteVLong(@out, value); }