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

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

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

ByteBuf.writeMedium介绍

[英]Sets the specified 24-bit medium integer at the current writerIndex and increases the writerIndex by 3in this buffer.
[中]在当前writerIndex处设置指定的24位中间整数,并在此缓冲区中将writerIndex增加3。

代码示例

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

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

代码示例来源: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: netty/netty

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

代码示例来源: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: redisson/redisson

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

代码示例来源: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: redisson/redisson

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

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

public Buffer appendMedium(int i) {
 buffer.writeMedium(i);
 return this;
}

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

/**
 * Write 3 byte fixed length integer to byte buffers.
 *
 * @param value 3 byte fixed length integer
 */
public void writeInt3(final int value) {
  byteBuf.writeMedium(value);
}

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

/**
 * Creates a new 3-byte big-endian buffer that holds the specified 24-bit integer.
 */
public static ByteBuf copyMedium(int value) {
  ByteBuf buf = buffer(3);
  buf.writeMedium(value);
  return buf;
}

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

/**
 * Create a new big-endian buffer that holds a sequence of the specified 24-bit integers.
 */
public static ByteBuf copyMedium(int... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 3);
  for (int v: values) {
    buffer.writeMedium(v);
  }
  return buffer;
}

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

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

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

/**
 * Creates a new 3-byte big-endian buffer that holds the specified 24-bit integer.
 */
public static ByteBuf copyMedium(int value) {
  ByteBuf buf = buffer(3);
  buf.writeMedium(value);
  return buf;
}

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

/**
 * Create a new big-endian buffer that holds a sequence of the specified 24-bit integers.
 */
public static ByteBuf copyMedium(int... values) {
  if (values == null || values.length == 0) {
    return EMPTY_BUFFER;
  }
  ByteBuf buffer = buffer(values.length * 3);
  for (int v: values) {
    buffer.writeMedium(v);
  }
  return buffer;
}

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

@Override
public ByteBuf writeMedium(int value) {
  buf.writeMedium(ByteBufUtil.swapMedium(value));
  return this;
}

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

/**
   * Writes any remaining bits to the output {@link ByteBuf},
   * zero padding to a whole byte as required.
   */
  void flush(ByteBuf out) {
    final int bitCount = this.bitCount;

    if (bitCount > 0) {
      final long bitBuffer = this.bitBuffer;
      final int shiftToRight = 64 - bitCount;

      if (bitCount <= 8) {
        out.writeByte((int) (bitBuffer >>> shiftToRight << 8 - bitCount));
      } else if (bitCount <= 16) {
        out.writeShort((int) (bitBuffer >>> shiftToRight << 16 - bitCount));
      } else if (bitCount <= 24) {
        out.writeMedium((int) (bitBuffer >>> shiftToRight << 24 - bitCount));
      } else {
        out.writeInt((int) (bitBuffer >>> shiftToRight << 32 - bitCount));
      }
    }
  }
}

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

/**
   * Writes any remaining bits to the output {@link ByteBuf},
   * zero padding to a whole byte as required.
   */
  void flush(ByteBuf out) {
    final int bitCount = this.bitCount;

    if (bitCount > 0) {
      final long bitBuffer = this.bitBuffer;
      final int shiftToRight = 64 - bitCount;

      if (bitCount <= 8) {
        out.writeByte((int) (bitBuffer >>> shiftToRight << 8 - bitCount));
      } else if (bitCount <= 16) {
        out.writeShort((int) (bitBuffer >>> shiftToRight << 16 - bitCount));
      } else if (bitCount <= 24) {
        out.writeMedium((int) (bitBuffer >>> shiftToRight << 24 - bitCount));
      } else {
        out.writeInt((int) (bitBuffer >>> shiftToRight << 32 - bitCount));
      }
    }
  }
}

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

private void writeControlFrameHeader(ByteBuf buffer, int type, byte flags, int length) {
  buffer.writeShort(version | 0x8000);
  buffer.writeShort(type);
  buffer.writeByte(flags);
  buffer.writeMedium(length);
}

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

@Override
public ByteBuf writeMedium(int value) {
  buf.writeMedium(ByteBufUtil.swapMedium(value));
  return this;
}

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

static void writeFrameHeaderInternal(ByteBuf out, int payloadLength, byte type,
    Http2Flags flags, int streamId) {
  out.writeMedium(payloadLength);
  out.writeByte(type);
  out.writeByte(flags.value());
  out.writeInt(streamId);
}

相关文章

ByteBuf类方法