Package reactor.io

Examples of reactor.io.Buffer.remaining()


              @Override
              public void accept(Frame frame) {
                short prefix = frame.getPrefix().readShort();
                assertThat("prefix is 0", prefix == 0);
                Buffer data = frame.getData();
                assertThat("len is 128", data.remaining() == 128);

                latch.countDown();
              }
            });
          }
View Full Code Here


    @Override
    public void accept(OUT data) {
      try {
        if (null != encoder) {
          Buffer bytes = encoder.apply(data);
          if (bytes.remaining() > 0) {
            write(bytes, onComplete, autoflush);
          }
        } else {
          if (Buffer.class.isInstance(data)) {
            write((Buffer) data, onComplete, autoflush);
View Full Code Here

      if(null == out) {
        return null;
      }

      Buffer encoded = encoder.apply(out);
      if(null != encoded && encoded.remaining() > 0) {
        int len = encoded.remaining();
        ByteBuffer bb = null;
        if(lengthFieldLength == 4) {
          bb = ByteBuffer.allocate(len + 4);
          bb.putInt(len);
View Full Code Here

        return null;
      }

      Buffer encoded = encoder.apply(out);
      if(null != encoded && encoded.remaining() > 0) {
        int len = encoded.remaining();
        ByteBuffer bb = null;
        if(lengthFieldLength == 4) {
          bb = ByteBuffer.allocate(len + 4);
          bb.putInt(len);
        } else if(lengthFieldLength == 2) {
View Full Code Here

    @Override
    @SuppressWarnings("resource")
    public Buffer apply(OUT out) {
      Buffer buffer = new Buffer();
      Buffer encoded = encoder.apply(out);
      if (null != encoded && encoded.remaining() > 0) {
        buffer.append(encoded).append(delimiter);
      }
      return buffer.flip();
    }
  }
View Full Code Here

  @Override
  public Long offer(@Nonnull T t) {
    synchronized (monitor) {
      Buffer buff = codec.encoder().apply(t);

      int len = buff.remaining();
      exAppender.startExcerpt(4 + len);
      exAppender.writeInt(len);
      exAppender.write(buff.byteBuffer());
      exAppender.finish();
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.