io.netty.buffer.ByteBuf.writeMediumLE()方法的使用及代码示例

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

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

ByteBuf.writeMediumLE介绍

[英]Sets the specified 24-bit medium integer at the current writerIndex in the Little Endian Byte Order and increases the writerIndex by 3 in this buffer.
[中]在当前writerIndex处以小尾端字节顺序设置指定的24位中间整数,并在此缓冲区中将writerIndex增加3。

代码示例

代码示例来源:origin: netty/netty

@Override
public ByteBuf writeMediumLE(int value) {
  buf.writeMediumLE(value);
  return this;
}

代码示例来源:origin: netty/netty

/**
 * Writes the 2-byte chunk length to the output buffer.
 *
 * @param out The buffer to write to
 * @param chunkLength The length to write
 */
private static void writeChunkLength(ByteBuf out, int chunkLength) {
  out.writeMediumLE(chunkLength);
}

代码示例来源:origin: redisson/redisson

/**
 * Writes the 2-byte chunk length to the output buffer.
 *
 * @param out The buffer to write to
 * @param chunkLength The length to write
 */
private static void writeChunkLength(ByteBuf out, int chunkLength) {
  out.writeMediumLE(chunkLength);
}

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

public Buffer appendMediumLE(int i) {
 buffer.writeMediumLE(i);
 return this;
}

代码示例来源:origin: apache/incubator-shardingsphere

/**
 * Write 3 byte fixed length integer to byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
 *
 * @param value 3 byte fixed length integer
 */
public void writeInt3(final int value) {
  byteBuf.writeMediumLE(value);
}

代码示例来源:origin: redisson/redisson

@Override
public ByteBuf writeMediumLE(int value) {
  buf.writeMediumLE(value);
  return this;
}

代码示例来源:origin: apache/incubator-shardingsphere

/**
 * Write 3 byte fixed length integer to byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger">FixedLengthInteger</a>
 *
 * @param value 3 byte fixed length integer
 */
public void writeInt3(final int value) {
  byteBuf.writeMediumLE(value);
}

代码示例来源:origin: wildfly/wildfly

@Override
public ByteBuf writeMediumLE(int value) {
  buf.writeMediumLE(value);
  return this;
}

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

@Override
public ByteBuf writeMediumLE(int value) {
  byteBuf.writeMediumLE(value);
  return this;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Writes the 2-byte chunk length to the output buffer.
 *
 * @param out The buffer to write to
 * @param chunkLength The length to write
 */
private static void writeChunkLength(ByteBuf out, int chunkLength) {
  out.writeMediumLE(chunkLength);
}

代码示例来源:origin: netty/netty

/**
 * Writes a big-endian 24-bit medium integer to the buffer.
 */
@SuppressWarnings("deprecation")
public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) {
  return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue);
}

代码示例来源:origin: redisson/redisson

/**
 * Writes a big-endian 24-bit medium integer to the buffer.
 */
@SuppressWarnings("deprecation")
public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) {
  return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue);
}

代码示例来源:origin: apache/incubator-shardingsphere

/**
 * Write lenenc integer to byte buffers.
 *
 * @param value lenenc integer
 */
public void writeIntLenenc(final long value) {
  if (value < 0xfb) {
    byteBuf.writeByte((int) value);
    return;
  }
  if (value < Math.pow(2, 16)) {
    byteBuf.writeByte(0xfc);
    byteBuf.writeShortLE((int) value);
    return;
  }
  if (value < Math.pow(2, 24)) {
    byteBuf.writeByte(0xfd);
    byteBuf.writeMediumLE((int) value);
    return;
  }
  byteBuf.writeByte(0xfe);
  byteBuf.writeLongLE(value);
}

代码示例来源:origin: apache/incubator-shardingsphere

/**
 * Write lenenc integer to byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger">LengthEncodedInteger</a>
 *
 * @param value lenenc integer
 */
public void writeIntLenenc(final long value) {
  if (value < 0xfb) {
    byteBuf.writeByte((int) value);
    return;
  }
  if (value < Math.pow(2, 16)) {
    byteBuf.writeByte(0xfc);
    byteBuf.writeShortLE((int) value);
    return;
  }
  if (value < Math.pow(2, 24)) {
    byteBuf.writeByte(0xfd);
    byteBuf.writeMediumLE((int) value);
    return;
  }
  byteBuf.writeByte(0xfe);
  byteBuf.writeLongLE(value);
}

代码示例来源:origin: apache/incubator-shardingsphere

/**
 * Write lenenc integer to byte buffers.
 * 
 * @see <a href="https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::LengthEncodedInteger">LengthEncodedInteger</a>
 *
 * @param value lenenc integer
 */
public void writeIntLenenc(final long value) {
  if (value < 0xfb) {
    byteBuf.writeByte((int) value);
    return;
  }
  if (value < Math.pow(2, 16)) {
    byteBuf.writeByte(0xfc);
    byteBuf.writeShortLE((int) value);
    return;
  }
  if (value < Math.pow(2, 24)) {
    byteBuf.writeByte(0xfd);
    byteBuf.writeMediumLE((int) value);
    return;
  }
  byteBuf.writeByte(0xfe);
  byteBuf.writeLongLE(value);
}

代码示例来源:origin: apache/incubator-shardingsphere

@Override
  protected void doEncode(final ChannelHandlerContext context, final MySQLPacket message, final ByteBuf out) {
    try (MySQLPacketPayload payload = new MySQLPacketPayload(context.alloc().buffer())) {
      message.write(payload);
      out.writeMediumLE(payload.getByteBuf().readableBytes());
      out.writeByte(message.getSequenceId());
      out.writeBytes(payload.getByteBuf());
    }
  }
}

代码示例来源:origin: apache/incubator-shardingsphere

@Override
  protected void doEncode(final ChannelHandlerContext context, final MySQLPacket message, final ByteBuf out) {
    try (MySQLPacketPayload payload = new MySQLPacketPayload(context.alloc().buffer())) {
      message.write(payload);
      out.writeMediumLE(payload.getByteBuf().readableBytes());
      out.writeByte(message.getSequenceId());
      out.writeBytes(payload.getByteBuf());
    }
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * Writes a big-endian 24-bit medium integer to the buffer.
 */
@SuppressWarnings("deprecation")
public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) {
  return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue);
}

代码示例来源:origin: io.netty/netty-buffer

@Override
public ByteBuf writeMediumLE(int value) {
  buf.writeMediumLE(value);
  return this;
}

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

public Buffer appendMediumLE(int i) {
 buffer.writeMediumLE(i);
 return this;
}

相关文章

ByteBuf类方法