@SuppressWarnings("deprecation") @Test public void setShortBE() { int shortValue = 0x1234; ByteBuf buf = Unpooled.wrappedBuffer(new byte[2]).order(ByteOrder.BIG_ENDIAN); ByteBufUtil.setShortBE(buf, 0, shortValue); assertEquals(shortValue, buf.readShort()); buf.resetReaderIndex(); assertEquals(ByteBufUtil.swapShort((short) shortValue), buf.readShortLE()); buf.release(); buf = Unpooled.wrappedBuffer(new byte[2]).order(ByteOrder.LITTLE_ENDIAN); ByteBufUtil.setShortBE(buf, 0, shortValue); assertEquals((short) shortValue, buf.readShortLE()); buf.resetReaderIndex(); assertEquals(ByteBufUtil.swapShort((short) shortValue), buf.readShort()); buf.release(); }
@SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); }
ByteBufUtil { @SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); } }
ByteBufUtil { @SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); } private  ByteBufUtil(); }
ByteBufUtil { @SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); } private  ByteBufUtil(); static String hexDump(ByteBuf buffer); static String hexDump(ByteBuf buffer, int fromIndex, int length); static String hexDump(byte[] array); static String hexDump(byte[] array, int fromIndex, int length); static byte decodeHexByte(CharSequence s, int pos); static byte[] decodeHexDump(CharSequence hexDump); static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length); static boolean ensureWritableSuccess(int ensureWritableResult); static int hashCode(ByteBuf buffer); static int indexOf(ByteBuf needle, ByteBuf haystack); static boolean equals(ByteBuf a, int aStartIndex, ByteBuf b, int bStartIndex, int length); static boolean equals(ByteBuf bufferA, ByteBuf bufferB); static int compare(ByteBuf bufferA, ByteBuf bufferB); static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value); static short swapShort(short value); static int swapMedium(int value); static int swapInt(int value); static long swapLong(long value); @SuppressWarnings("deprecation") static ByteBuf writeShortBE(ByteBuf buf, int shortValue); @SuppressWarnings("deprecation") static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue); @SuppressWarnings("deprecation") static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue); static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length); static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq); static int writeUtf8(ByteBuf buf, CharSequence seq); static int utf8MaxBytes(CharSequence seq); static ByteBuf writeAscii(ByteBufAllocator alloc, CharSequence seq); static int writeAscii(ByteBuf buf, CharSequence seq); static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset); static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset, int extraCapacity); static ByteBuf threadLocalDirectBuffer(); static byte[] getBytes(ByteBuf buf); static byte[] getBytes(ByteBuf buf, int start, int length); static byte[] getBytes(ByteBuf buf, int start, int length, boolean copy); static void copy(AsciiString src, ByteBuf dst); static void copy(AsciiString src, int srcIdx, ByteBuf dst, int dstIdx, int length); static void copy(AsciiString src, int srcIdx, ByteBuf dst, int length); static String prettyHexDump(ByteBuf buffer); static String prettyHexDump(ByteBuf buffer, int offset, int length); static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf); static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length); static boolean isText(ByteBuf buf, Charset charset); static boolean isText(ByteBuf buf, int index, int length, Charset charset); }
ByteBufUtil { @SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); } private  ByteBufUtil(); static String hexDump(ByteBuf buffer); static String hexDump(ByteBuf buffer, int fromIndex, int length); static String hexDump(byte[] array); static String hexDump(byte[] array, int fromIndex, int length); static byte decodeHexByte(CharSequence s, int pos); static byte[] decodeHexDump(CharSequence hexDump); static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length); static boolean ensureWritableSuccess(int ensureWritableResult); static int hashCode(ByteBuf buffer); static int indexOf(ByteBuf needle, ByteBuf haystack); static boolean equals(ByteBuf a, int aStartIndex, ByteBuf b, int bStartIndex, int length); static boolean equals(ByteBuf bufferA, ByteBuf bufferB); static int compare(ByteBuf bufferA, ByteBuf bufferB); static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value); static short swapShort(short value); static int swapMedium(int value); static int swapInt(int value); static long swapLong(long value); @SuppressWarnings("deprecation") static ByteBuf writeShortBE(ByteBuf buf, int shortValue); @SuppressWarnings("deprecation") static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue); @SuppressWarnings("deprecation") static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue); static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length); static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq); static int writeUtf8(ByteBuf buf, CharSequence seq); static int utf8MaxBytes(CharSequence seq); static ByteBuf writeAscii(ByteBufAllocator alloc, CharSequence seq); static int writeAscii(ByteBuf buf, CharSequence seq); static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset); static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset, int extraCapacity); static ByteBuf threadLocalDirectBuffer(); static byte[] getBytes(ByteBuf buf); static byte[] getBytes(ByteBuf buf, int start, int length); static byte[] getBytes(ByteBuf buf, int start, int length, boolean copy); static void copy(AsciiString src, ByteBuf dst); static void copy(AsciiString src, int srcIdx, ByteBuf dst, int dstIdx, int length); static void copy(AsciiString src, int srcIdx, ByteBuf dst, int length); static String prettyHexDump(ByteBuf buffer); static String prettyHexDump(ByteBuf buffer, int offset, int length); static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf); static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length); static boolean isText(ByteBuf buf, Charset charset); static boolean isText(ByteBuf buf, int index, int length, Charset charset);  }