For IntelliJ IDEA,
Android Studio or Eclipse



private void myMethod () {Buffer b =
DataByteArrayOutputStream dataByteArrayOutputStream;dataByteArrayOutputStream.toBuffer()
new Buffer(data)
new Buffer(size)
- Smart code suggestions by Codota
}
public Buffer getNextBuffer(int len) throws IOException { int newPos = pos + len; checkCapacity(newPos); return new Buffer(buffer, pos, len); }
public Buffer decode(DataInput dataIn) throws IOException { byte[] data = new byte[size]; dataIn.readFully(data); return new Buffer(data); }
/** * Given a long value, convert it to a byte array for marshalling. * * @param value the value to convert. * @return a new byte array that holds the big endian value of the long. */ public static byte[] toBytes(long value) { Buffer buffer = new Buffer(8); buffer.bigEndianEditor().writeLong(value); return buffer.data; }
private void initializeReading() throws MessageNotReadableException { checkWriteOnlyBody(); if (this.dataIn == null) { Buffer buffer = getContent(); if (buffer == null) { buffer = new Buffer(new byte[]{}, 0, 0); } this.dataIn = new DataInputStream(new ByteArrayInputStream(buffer)); } }
private void initializeReading() throws JMSException { checkWriteOnlyBody(); if (dataIn == null) { Buffer buffer = getContent(); if (buffer==null) { buffer = new Buffer(0); } dataIn = new DataInputStream(new ByteArrayInputStream(buffer)); this.length = buffer.getLength(); } }
public Buffer readBuffer(int len) { Buffer rc=null; if (pos < limit) { len = Math.min(len, limit - pos); rc = new Buffer(buffer, pos, len); pos += len; } return rc; }
@Override public void reset(int nextExpectedReadSize) { // Allocate a new Buffer to hold the incoming frame. We must write // back the frame size value before continue on to read the indicated // frame size minus the size of the AMQP frame size header value. frame = new Buffer(nextExpectedReadSize); frame.bigEndianEditor().writeInt(nextExpectedReadSize); // Reset the length to total length as we do direct write after this. frame.length = frame.data.length; } };
static private String hex(SocketAddress address) { if( address instanceof InetSocketAddress ) { InetSocketAddress isa = (InetSocketAddress)address; return HexSupport.toHexFromBuffer(new Buffer(isa.getAddress().getAddress()))+Integer.toHexString(isa.getPort()); } return ""; }
final public Buffer compact() { if (length != data.length) { return new Buffer(toByteArray()); } return this; }
public Buffer readBuffer(int len) { int endpos = offset + length; if (pos > endpos) { return null; } if (pos + len > endpos) { len = length - pos; } Buffer rc = new Buffer(buf, pos, len); pos += len; return rc; }
@Override protected Buffer createBuffer(byte[] data) { return new Buffer(data); } }
public Buffer decode(DataInput dataIn) throws IOException { byte[] data = new byte[size]; dataIn.readFully(data); return new Buffer(data); }
final public Buffer trimEnd() { byte data[] = this.data; int offset = this.offset; int length = this.length; int end = offset+this.length-1; int pos = end; while ((offset <= pos) && (data[pos] <= ' ')) { pos--; } return (pos == end) ? this : new Buffer(data, offset, (length-(end-pos))); }
/** * Get a Buffer from the stream * * @return the byte sequence */ public Buffer toBuffer() { return new Buffer(buf, 0, pos); }
final public Buffer trimFront() { byte data[] = this.data; int offset = this.offset; int end = offset+this.length; int pos = offset; while ((pos < end) && (data[pos] <= ' ')) { pos++; } return (pos == offset) ? this : new Buffer(data, pos, (length-(pos-offset))); }