org.vertx.java.core.buffer.Buffer.appendBytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.vertx.java.core.buffer.Buffer.appendBytes()方法的一些代码示例,展示了Buffer.appendBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.appendBytes()方法的具体详情如下:
包路径:org.vertx.java.core.buffer.Buffer
类名称:Buffer
方法名:appendBytes

Buffer.appendBytes介绍

[英]Appends the specified byte[] to the end of the Buffer. The buffer will expand as necessary to accomodate any bytes written.

Returns a reference to this so multiple operations can be appended together.
[中]将指定的字节[]追加到缓冲区的末尾。缓冲区将根据需要扩展以容纳写入的任何字节。
返回对此的引用,以便可以将多个操作附加在一起。

代码示例

代码示例来源:origin: com.englishtown/vertx-mod-jersey

/**
 * {@inheritDoc}
 */
@Override
public void write(byte[] b, int off, int len) throws IOException {
  checkState();
  if (off == 0 && len == b.length) {
    buffer.appendBytes(b);
  } else {
    buffer.appendBytes(Arrays.copyOfRange(b, off, off + len));
  }
}

代码示例来源:origin: org.vert-x/vertx-core

protected void writeString(Buffer buff, String str) {
 byte[] strBytes = str.getBytes(CharsetUtil.UTF_8);
 buff.appendInt(strBytes.length);
 buff.appendBytes(strBytes);
}

代码示例来源:origin: com.englishtown/vertx-mod-jersey

/**
 * {@inheritDoc}
 */
@Override
public void write(byte[] b) throws IOException {
  checkState();
  buffer.appendBytes(b);
}

代码示例来源:origin: com.englishtown/vertx-mod-jersey

/**
 * {@inheritDoc}
 */
@Override
public void write(byte[] b, int off, int len) throws IOException {
  checkState();
  Buffer buffer = new Buffer();
  if (off == 0 && len == b.length) {
    buffer.appendBytes(b);
  } else {
    buffer.appendBytes(Arrays.copyOfRange(b, off, off + len));
  }
  response.write(buffer);
}

代码示例来源:origin: org.vert-x/vertx-core

protected void writeBody(Buffer buff) {
 if (body == null) {
  buff.appendByte((byte)0);
 } else {
  buff.appendByte((byte)1);
  buff.appendInt(body.length);
  buff.appendBytes(body);
 }
}

代码示例来源:origin: org.vert-x/vertx-core

protected void writeBody(Buffer buff) {
 if (body == null) {
  buff.appendByte((byte)0);
 } else {
  buff.appendByte((byte)1);
  buff.appendInt(encoded.length);
  buff.appendBytes(encoded);
 }
}

代码示例来源:origin: org.vert-x/vertx-core

protected void writeBody(Buffer buff) {
 if (body == null) {
  buff.appendByte((byte)0);
 } else {
  buff.appendByte((byte)1);
  buff.appendInt(encoded.length);
  buff.appendBytes(encoded);
 }
 encoded = null;
}

代码示例来源:origin: org.vert-x/vertx-core

protected void writeBody(Buffer buff) {
 if (body == null) {
  buff.appendByte((byte)0);
 } else {
  buff.appendByte((byte)1);
  buff.appendInt(encoded.length);
  buff.appendBytes(encoded);
 }
}

代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq

encryptedWriteBuffer = new Buffer(len);
encryptedWriteBuffer.appendBytes(output.array(), output.arrayOffset() + output.position(), len);
plainWriteBuffer.appendBytes(input.array(), input.arrayOffset() + input.position(), len);

代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq

plainReadBuffer = new Buffer(len);
plainReadBuffer.appendBytes(output.array(), output.arrayOffset() + output.position(), len);
encryptedReadBuffer.appendBytes(input.array(), input.arrayOffset() + input.position(), len);

代码示例来源:origin: org.vert-x/vertx-core

public void fillInRequest(HttpClientRequest req, String hostHeader) throws Exception {
 req.headers().put(HttpHeaders.Names.CONNECTION, "Upgrade");
 req.headers().put(HttpHeaders.Names.UPGRADE, "WebSocket");
 req.headers().put(HttpHeaders.Names.HOST, hostHeader);
 req.headers().put(HttpHeaders.Names.SEC_WEBSOCKET_KEY1, this.challenge.getKey1String());
 req.headers().put(HttpHeaders.Names.SEC_WEBSOCKET_KEY2, this.challenge.getKey2String());
 Buffer buff = new Buffer(6);
 buff.appendBytes(challenge.getKey3());
 buff.appendByte((byte) '\r');
 buff.appendByte((byte) '\n');
 req.write(buff);
}

代码示例来源:origin: jboss-fuse/fabric8

plainReadBuffer = new Buffer(len);
plainReadBuffer.appendBytes(output.array(), output.arrayOffset()+ output.position(), len);
encryptedReadBuffer.appendBytes(input.array(), input.arrayOffset()+ input.position(), len);

代码示例来源:origin: io.fabric8/gateway-core

plainReadBuffer = new Buffer(len);
plainReadBuffer.appendBytes(output.array(), output.arrayOffset()+ output.position(), len);
encryptedReadBuffer.appendBytes(input.array(), input.arrayOffset()+ input.position(), len);

代码示例来源:origin: jboss-fuse/fabric8

encryptedWriteBuffer = new Buffer(len);
encryptedWriteBuffer.appendBytes(output.array(), output.arrayOffset()+ output.position(), len);
plainWriteBuffer.appendBytes(input.array(), input.arrayOffset()+ input.position(), len);

代码示例来源:origin: io.fabric8/gateway-core

encryptedWriteBuffer = new Buffer(len);
encryptedWriteBuffer.appendBytes(output.array(), output.arrayOffset()+ output.position(), len);
plainWriteBuffer.appendBytes(input.array(), input.arrayOffset()+ input.position(), len);

代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq

encryptedWriteBuffer = new Buffer(len);
encryptedWriteBuffer.appendBytes(output.array(), output.arrayOffset() + output.position(), len);
plainWriteBuffer.appendBytes(input.array(), input.arrayOffset() + input.position(), len);

代码示例来源:origin: io.fabric8/gateway-core

static void append(Buffer self, MQTTFrame value) {
  MQTTFrame frame = (MQTTFrame) value;
  self.appendByte(frame.header());
  int remaining = 0;
  for(org.fusesource.hawtbuf.Buffer buffer : frame.buffers) {
    remaining += buffer.length;
  }
  do {
    byte digit = (byte) (remaining & 0x7F);
    remaining >>>= 7;
    if (remaining > 0) {
      digit |= 0x80;
    }
    self.appendByte(digit);
  } while (remaining > 0);
  for(org.fusesource.hawtbuf.Buffer buffer : frame.buffers) {
    // TODO: see if we avoid the byte[] conversion.
    self.appendBytes(buffer.toByteArray());
  }
}

代码示例来源:origin: jboss-fuse/fabric8

static void append(Buffer self, MQTTFrame value) {
  MQTTFrame frame = (MQTTFrame) value;
  self.appendByte(frame.header());
  int remaining = 0;
  for(org.fusesource.hawtbuf.Buffer buffer : frame.buffers) {
    remaining += buffer.length;
  }
  do {
    byte digit = (byte) (remaining & 0x7F);
    remaining >>>= 7;
    if (remaining > 0) {
      digit |= 0x80;
    }
    self.appendByte(digit);
  } while (remaining > 0);
  for(org.fusesource.hawtbuf.Buffer buffer : frame.buffers) {
    // TODO: see if we avoid the byte[] conversion.
    self.appendBytes(buffer.toByteArray());
  }
}

代码示例来源:origin: io.fabric8.jube.images.fabric8/fabric8-mq

static void append(Buffer self, MQTTFrame value) {
  self.appendByte(value.header());
  int remaining = 0;
  for (org.fusesource.hawtbuf.Buffer buffer : value.buffers) {
    remaining += buffer.length;
  }
  do {
    byte digit = (byte) (remaining & 0x7F);
    remaining >>>= 7;
    if (remaining > 0) {
      digit |= 0x80;
    }
    self.appendByte(digit);
  } while (remaining > 0);
  for (org.fusesource.hawtbuf.Buffer buffer : value.buffers) {
    // TODO: see if we avoid the byte[] conversion.
    self.appendBytes(buffer.toByteArray());
  }
}

代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq

static void append(Buffer self, MQTTFrame value) {
  self.appendByte(value.header());
  int remaining = 0;
  for (org.fusesource.hawtbuf.Buffer buffer : value.buffers) {
    remaining += buffer.length;
  }
  do {
    byte digit = (byte) (remaining & 0x7F);
    remaining >>>= 7;
    if (remaining > 0) {
      digit |= 0x80;
    }
    self.appendByte(digit);
  } while (remaining > 0);
  for (org.fusesource.hawtbuf.Buffer buffer : value.buffers) {
    // TODO: see if we avoid the byte[] conversion.
    self.appendBytes(buffer.toByteArray());
  }
}

相关文章