Examples of appendBuffer()


Examples of io.vertx.core.buffer.Buffer.appendBuffer()

    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));
  }

View Full Code Here

Examples of io.vertx.core.buffer.Buffer.appendBuffer()

    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;
View Full Code Here

Examples of io.vertx.core.buffer.Buffer.appendBuffer()

            sock.handler(rec -> {
              assertSame(ctx, vertx.context());
              if (!worker) {
                assertSame(thr, Thread.currentThread());
              }
              brec.appendBuffer(rec);
              if (brec.length() == buff.length()) {
                testComplete();
              }
            });
          });
View Full Code Here

Examples of io.vertx.core.buffer.Buffer.appendBuffer()

    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();
          }
View Full Code Here

Examples of io.vertx.core.buffer.Buffer.appendBuffer()

    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();
          }
View Full Code Here

Examples of org.smpp.util.ByteBuffer.appendBuffer()

      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
View Full Code Here

Examples of org.smpp.util.ByteBuffer.appendBuffer()

    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) {
View Full Code Here

Examples of org.smpp.util.ByteBuffer.appendBuffer()

  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;
    }
  }
View Full Code Here

Examples of org.vertx.java.core.buffer.Buffer.appendBuffer()

        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 + ".");
                    }
                }
View Full Code Here

Examples of org.vertx.java.core.buffer.Buffer.appendBuffer()

            }
            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 + ".");
                    }
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.