@Test public void testAutoExpand() { int initial_small_size = Buffer.SMALL_BUFFER_SIZE; int initial_max_size = Buffer.MAX_BUFFER_SIZE; try { Buffer b = new Buffer(); Buffer.SMALL_BUFFER_SIZE = 20; Buffer.MAX_BUFFER_SIZE = 100; for(int i=0; i< Buffer.MAX_BUFFER_SIZE - Buffer.SMALL_BUFFER_SIZE; i++) { b.append((byte)0x1); } } finally { Buffer.SMALL_BUFFER_SIZE = initial_small_size; Buffer.MAX_BUFFER_SIZE = initial_max_size; } }
public Buffer append(String s) { ensureCapacity(s.length()); buffer.put(s.getBytes()); return this; }
Buffer implements Recyclable, Comparable<Buffer>, Iterable<Byte>, ReadableByteChannel, WritableByteChannel { public Buffer append(String s) { ensureCapacity(s.length()); buffer.put(s.getBytes()); return this; } }
Buffer implements Recyclable, Comparable<Buffer>, Iterable<Byte>, ReadableByteChannel, WritableByteChannel { public Buffer append(String s) { ensureCapacity(s.length()); buffer.put(s.getBytes()); return this; } Buffer();  Buffer(int atLeast, boolean fixed);  Buffer(Buffer bufferToCopy);  Buffer(ByteBuffer bufferToStartWith); }
Buffer implements Recyclable, Comparable<Buffer>, Iterable<Byte>, ReadableByteChannel, WritableByteChannel { public Buffer append(String s) { ensureCapacity(s.length()); buffer.put(s.getBytes()); return this; } Buffer();  Buffer(int atLeast, boolean fixed);  Buffer(Buffer bufferToCopy);  Buffer(ByteBuffer bufferToStartWith); @SuppressWarnings("resource") static Buffer wrap(byte[] bytes); @SuppressWarnings("resource") static Buffer wrap(String str, boolean fixed); static Buffer wrap(String str); static Integer parseInt(Buffer b, int start, int end); static Integer parseInt(Buffer b); static Long parseLong(Buffer b, int start, int end); static Long parseLong(Buffer b); @Override void recycle(); final boolean isDynamic(); final int position(); Buffer position(int pos); Buffer limit(int limit); Buffer skip(int len); int limit(); int capacity(); int remaining(); Buffer clear(); Buffer compact(); Buffer flip(); Buffer rewind(); Buffer rewind(int len); Buffer duplicate(); Buffer copy(); Buffer prepend(Buffer b); Buffer prepend(String s); Buffer prepend(byte[] bytes); Buffer prepend(ByteBuffer b); Buffer prepend(byte b); Buffer prepend(char c); Buffer prepend(short s); Buffer prepend(int i); Buffer prepend(long l); Buffer append(String s); Buffer append(short s); Buffer append(int i); Buffer append(long l); Buffer append(char c); Buffer append(ByteBuffer... buffers); Buffer append(Buffer... buffers); Buffer append(byte b); Buffer append(byte[] b); Buffer append(byte[] b, int start, int len); byte first(); byte last(); byte read(); Buffer read(byte[] b); short readShort(); int readInt(); float readFloat(); double readDouble(); long readLong(); char readChar(); void snapshot(); Buffer reset(); @Override Iterator<Byte> iterator(); @Override int read(ByteBuffer dst); @Override int write(ByteBuffer src); @Override boolean isOpen(); @Override void close(); String asString(); String substring(int start, int end); byte[] asBytes(); InputStream inputStream(); Buffer slice(int start, int len); List<View> split(int delimiter); List<View> split(List<View> views, int delimiter); List<View> split(int delimiter, boolean stripDelimiter); List<View> split(List<View> views, int delimiter, boolean stripDelimiter); Iterable<View> split(Buffer delimiter); Iterable<View> split(Buffer delimiter, boolean stripDelimiter); Iterable<View> split(List<View> views, Buffer delimiter, boolean stripDelimiter); int indexOf(byte b); int indexOf(byte b, int start, int end); View createView(); View createView(int start, int end); List<View> slice(int... positions); ByteBuffer byteBuffer(); boolean isDelimitingBuffer(); @Override String toString(); @Override int compareTo(Buffer buffer); }
Buffer implements Recyclable, Comparable<Buffer>, Iterable<Byte>, ReadableByteChannel, WritableByteChannel { public Buffer append(String s) { ensureCapacity(s.length()); buffer.put(s.getBytes()); return this; } Buffer();  Buffer(int atLeast, boolean fixed);  Buffer(Buffer bufferToCopy);  Buffer(ByteBuffer bufferToStartWith); @SuppressWarnings("resource") static Buffer wrap(byte[] bytes); @SuppressWarnings("resource") static Buffer wrap(String str, boolean fixed); static Buffer wrap(String str); static Integer parseInt(Buffer b, int start, int end); static Integer parseInt(Buffer b); static Long parseLong(Buffer b, int start, int end); static Long parseLong(Buffer b); @Override void recycle(); final boolean isDynamic(); final int position(); Buffer position(int pos); Buffer limit(int limit); Buffer skip(int len); int limit(); int capacity(); int remaining(); Buffer clear(); Buffer compact(); Buffer flip(); Buffer rewind(); Buffer rewind(int len); Buffer duplicate(); Buffer copy(); Buffer prepend(Buffer b); Buffer prepend(String s); Buffer prepend(byte[] bytes); Buffer prepend(ByteBuffer b); Buffer prepend(byte b); Buffer prepend(char c); Buffer prepend(short s); Buffer prepend(int i); Buffer prepend(long l); Buffer append(String s); Buffer append(short s); Buffer append(int i); Buffer append(long l); Buffer append(char c); Buffer append(ByteBuffer... buffers); Buffer append(Buffer... buffers); Buffer append(byte b); Buffer append(byte[] b); Buffer append(byte[] b, int start, int len); byte first(); byte last(); byte read(); Buffer read(byte[] b); short readShort(); int readInt(); float readFloat(); double readDouble(); long readLong(); char readChar(); void snapshot(); Buffer reset(); @Override Iterator<Byte> iterator(); @Override int read(ByteBuffer dst); @Override int write(ByteBuffer src); @Override boolean isOpen(); @Override void close(); String asString(); String substring(int start, int end); byte[] asBytes(); InputStream inputStream(); Buffer slice(int start, int len); List<View> split(int delimiter); List<View> split(List<View> views, int delimiter); List<View> split(int delimiter, boolean stripDelimiter); List<View> split(List<View> views, int delimiter, boolean stripDelimiter); Iterable<View> split(Buffer delimiter); Iterable<View> split(Buffer delimiter, boolean stripDelimiter); Iterable<View> split(List<View> views, Buffer delimiter, boolean stripDelimiter); int indexOf(byte b); int indexOf(byte b, int start, int end); View createView(); View createView(int start, int end); List<View> slice(int... positions); ByteBuffer byteBuffer(); boolean isDelimitingBuffer(); @Override String toString(); @Override int compareTo(Buffer buffer); static int SMALL_BUFFER_SIZE; static int MAX_BUFFER_SIZE; static final Buffer DELIMITING_BUFFER; }