io.micronaut.core.io.buffer.ByteBuffer.write()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(115)

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

ByteBuffer.write介绍

[英]Sets the specified byte at the current writerIndexand increases the writerIndex by 1 in this buffer. The 24 high-order bits of the specified value are ignored.
[中]在当前writerIndex处设置指定字节,并在此缓冲区中将writerIndex增加1。指定值的24个高位将被忽略。

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

/**
   * @param eventData The byte buffer
   * @param attribute The attribute
   * @param value     The value
   */
  protected void writeAttribute(ByteBuffer eventData, byte[] attribute, String value) {
    if (value != null) {
      eventData.write(attribute)
        .write(value, defaultCharset)
        .write(NEWLINE);
    }
  }
}

代码示例来源:origin: micronaut-projects/micronaut-core

eventData.write(DATA_PREFIX)
  .write(body)
  .write(NEWLINE) // Write new lines for event separation
  .write(NEWLINE);
return eventData;

代码示例来源:origin: io.micronaut/http-server

/**
   * @param eventData The byte buffer
   * @param attribute The attribute
   * @param value     The value
   */
  protected void writeAttribute(ByteBuffer eventData, byte[] attribute, String value) {
    if (value != null) {
      eventData.write(attribute)
        .write(value, serverConfiguration.getDefaultCharset())
        .write(NEWLINE);
    }
  }
}

代码示例来源:origin: io.micronaut/runtime

@Override
  public <T> ByteBuffer encode(T object, ByteBufferFactory allocator) throws CodecException {
    byte[] bytes = encode(object);
    int len = bytes.length;

    return allocator.buffer(len, len).write(bytes);
  }
}

代码示例来源:origin: io.micronaut/http-server

eventData.write(DATA_PREFIX)
  .write(body)
  .write(NEWLINE) // Write new lines for event separation
  .write(NEWLINE);
return eventData;

相关文章