Returns a reference to {@code this} so multiple operations can be appended together.
122123124125126127128129130131132
assertEquals(b.length(), len); byte[] copy = new byte[len]; System.arraycopy(bytes, 1, copy, 0, len); assertTrue(TestUtils.byteArraysEqual(copy, b.getBytes())); b.appendBuffer(src, 1, len); assertEquals(b.length(), 2 * len); assertNullPointerException(() -> b.appendBuffer(null, 1, len)); }
125126127128129130131132133134135
assertTrue(TestUtils.byteArraysEqual(copy, b.getBytes())); b.appendBuffer(src, 1, len); assertEquals(b.length(), 2 * len); assertNullPointerException(() -> b.appendBuffer(null, 1, len)); } @Test public void testAppendByte() throws Exception { int bytesLen = 100;
17271728172917301731173217331734173517361737
sock.handler(rec -> { assertSame(ctx, vertx.context()); if (!worker) { assertSame(thr, Thread.currentThread()); } brec.appendBuffer(rec); if (brec.length() == buff.length()) { testComplete(); } }); });
740741742743744745746747748749750
server.listen(ar -> { assertTrue(ar.succeeded()); client.connectWebsocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, null, version, ws -> { Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); }
765766767768769770771772773774775
server.listen(ar -> { assertTrue(ar.succeeded()); client.connectWebsocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, null, version, subProtocol, ws -> { final Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); }
196197198199200201202203204205206
if (pdu == null) { // only if we didn't manage to get pdu from unproc buffer = connection.receive(); unprocBuffer = unprocessed.getUnprocessed(); // if received something now or have something from the last receive if (buffer.length() != 0) { unprocBuffer.appendBuffer(buffer); unprocessed.setLastTimeReceived(); pdu = tryGetUnprocessedPDU(unprocessed); } else { debug.write(DRXTXD2, "no data received this time."); // check if it's not too long since we received any data
6162636465666768697071
markValueSet(); } protected ByteBuffer getValueData() throws ValueNotSetException { ByteBuffer valueBuf = new ByteBuffer(); valueBuf.appendBuffer(getValue()); return valueBuf; } public void setValue(ByteBuffer p_value) { if (p_value != null) {
160161162163164165166167168169170
public ByteBuffer getData() throws ValueNotSetException { if (hasValue()) { ByteBuffer tlvBuf = new ByteBuffer(); tlvBuf.appendShort(getTag()); tlvBuf.appendShort(encodeUnsigned(getLength())); tlvBuf.appendBuffer(getValueData()); return tlvBuf; } else { return null; } }
100101102103104105106107108109110
if (shouldReadData(vertxRequest)) { final Buffer body = new Buffer(); vertxRequest.dataHandler(new Handler<Buffer>() { public void handle(Buffer buff) { body.appendBuffer(buff); if (body.length() > maxBodySize) { throw new RuntimeException("The input stream has exceeded the max allowed body size " + maxBodySize + "."); } }
118119120121122123124125126127128
} final Buffer body = new Buffer(); vertxRequest.dataHandler(new Handler<Buffer>() { public void handle(Buffer buff) { body.appendBuffer(buff); if (body.length() > maxBodySize) { throw new RuntimeException("The input stream has exceeded the max allowed body size " + maxBodySize + "."); } }