cache: fix writeBigSmart
This commit is contained in:
@@ -100,7 +100,7 @@ public final class OutputStream extends java.io.OutputStream
|
|||||||
public void writeBigSmart(int value)
|
public void writeBigSmart(int value)
|
||||||
{
|
{
|
||||||
Preconditions.checkArgument(value >= 0);
|
Preconditions.checkArgument(value >= 0);
|
||||||
if (value >= 65536)
|
if (value >= 32768)
|
||||||
{
|
{
|
||||||
ensureRemaining(4);
|
ensureRemaining(4);
|
||||||
this.writeInt((1 << 31) | value);
|
this.writeInt((1 << 31) | value);
|
||||||
|
|||||||
@@ -35,10 +35,12 @@ public class OutputStreamTest
|
|||||||
OutputStream os = new OutputStream();
|
OutputStream os = new OutputStream();
|
||||||
os.writeBigSmart(42);
|
os.writeBigSmart(42);
|
||||||
os.writeBigSmart(70000);
|
os.writeBigSmart(70000);
|
||||||
|
os.writeBigSmart(65535);
|
||||||
|
|
||||||
InputStream is = new InputStream(os.getArray());
|
InputStream is = new InputStream(os.getArray());
|
||||||
Assert.assertEquals(42, is.readBigSmart());
|
Assert.assertEquals(42, is.readBigSmart());
|
||||||
Assert.assertEquals(70000, is.readBigSmart());
|
Assert.assertEquals(70000, is.readBigSmart());
|
||||||
|
Assert.assertEquals(65535, is.readBigSmart());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user