@Test public void testEnsureCapacity() throws Exception { final ByteArrayBuffer buffer = new ByteArrayBuffer(4); buffer.ensureCapacity(2); Assert.assertEquals(4, buffer.capacity()); buffer.ensureCapacity(8); Assert.assertEquals(8, buffer.capacity()); }
public void ensureCapacity(final int required) { if (required <= 0) { return; } final int available = this.array.length - this.len; if (required > available) { expand(this.len + required); } }
ByteArrayBuffer implements Serializable { public void ensureCapacity(final int required) { if (required <= 0) { return; } final int available = this.array.length - this.len; if (required > available) { expand(this.len + required); } } }
ByteArrayBuffer implements Serializable { public void ensureCapacity(final int required) { if (required <= 0) { return; } final int available = this.array.length - this.len; if (required > available) { expand(this.len + required); } } ByteArrayBuffer(final int capacity); }
ByteArrayBuffer implements Serializable { public void ensureCapacity(final int required) { if (required <= 0) { return; } final int available = this.array.length - this.len; if (required > available) { expand(this.len + required); } } ByteArrayBuffer(final int capacity); void append(final byte[] b, final int off, final int len); void append(final int b); void append(final char[] b, final int off, final int len); void append(final CharArrayBuffer b, final int off, final int len); void append(final ByteBuffer buffer); void clear(); byte[] toByteArray(); int byteAt(final int i); int capacity(); int length(); void ensureCapacity(final int required); byte[] array(); void setLength(final int len); boolean isEmpty(); boolean isFull(); int indexOf(final byte b, final int from, final int to); int indexOf(final byte b); }
ByteArrayBuffer implements Serializable { public void ensureCapacity(final int required) { if (required <= 0) { return; } final int available = this.array.length - this.len; if (required > available) { expand(this.len + required); } } ByteArrayBuffer(final int capacity); void append(final byte[] b, final int off, final int len); void append(final int b); void append(final char[] b, final int off, final int len); void append(final CharArrayBuffer b, final int off, final int len); void append(final ByteBuffer buffer); void clear(); byte[] toByteArray(); int byteAt(final int i); int capacity(); int length(); void ensureCapacity(final int required); byte[] array(); void setLength(final int len); boolean isEmpty(); boolean isFull(); int indexOf(final byte b, final int from, final int to); int indexOf(final byte b);  }