|
|
@ -189,6 +189,9 @@ public class ByteBuffer extends OutputStream { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ByteBuffer append_i(int b) { |
|
|
|
public ByteBuffer append_i(int b) { |
|
|
|
int newcount = count + 1; |
|
|
|
int newcount = count + 1; |
|
|
|
|
|
|
|
if (newcount < 0) { |
|
|
|
|
|
|
|
throw new OutOfMemoryError(); |
|
|
|
|
|
|
|
} |
|
|
|
if (newcount > buf.length) { |
|
|
|
if (newcount > buf.length) { |
|
|
|
byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)]; |
|
|
|
byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)]; |
|
|
|
System.arraycopy(buf, 0, newbuf, 0, count); |
|
|
|
System.arraycopy(buf, 0, newbuf, 0, count); |
|
|
@ -212,6 +215,9 @@ public class ByteBuffer extends OutputStream { |
|
|
|
((off + len) > b.length) || ((off + len) < 0) || len == 0) |
|
|
|
((off + len) > b.length) || ((off + len) < 0) || len == 0) |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
int newcount = count + len; |
|
|
|
int newcount = count + len; |
|
|
|
|
|
|
|
if (newcount < 0) { |
|
|
|
|
|
|
|
throw new OutOfMemoryError(); |
|
|
|
|
|
|
|
} |
|
|
|
if (newcount > buf.length) { |
|
|
|
if (newcount > buf.length) { |
|
|
|
byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)]; |
|
|
|
byte newbuf[] = new byte[Math.max(Math.min(buf.length, HALF_INTEGER) << 1, newcount)]; |
|
|
|
System.arraycopy(buf, 0, newbuf, 0, count); |
|
|
|
System.arraycopy(buf, 0, newbuf, 0, count); |
|
|
|