/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
/** * Writes a literal to the supplied output buffer by directly copying from * the input buffer. The literal is taken from the current readerIndex * up to the supplied length. * * @param in The input buffer to copy from * @param out The output buffer to copy to * @param length The length of the literal to copy */ static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }