* @param value A {@link Uint8}
* @throws NullPointerException if any argument is null
*/
- public static void write(final ByteBuf buf, final Uint8 value) {
+ public static void writeUint8(final ByteBuf buf, final Uint8 value) {
buf.writeByte(value.byteValue());
}
* @param value A {@link Uint16}
* @throws NullPointerException if any argument is null
*/
- public static void write(final ByteBuf buf, final Uint16 value) {
+ public static void writeUint16(final ByteBuf buf, final Uint16 value) {
buf.writeShort(value.shortValue());
}
/**
- * Write a {@link Uint32} from specified buffer.
+ * Write a {@link Uint32} to specified buffer.
*
* @param buf buffer
* @param value A {@link Uint32}
* @throws NullPointerException if any argument is null
*/
- public static void write(final ByteBuf buf, final Uint32 value) {
+ public static void writeUint32(final ByteBuf buf, final Uint32 value) {
buf.writeInt(value.intValue());
}
* @param value A {@link Uint64}
* @throws NullPointerException if any argument is null
*/
- public static void write(final ByteBuf buf, final Uint64 value) {
+ public static void writeUint64(final ByteBuf buf, final Uint64 value) {
buf.writeLong(value.longValue());
}
+ /**
+ * Write a {@link Uint8} to specified buffer. This method is provided for convenience, you may want to use
+ * {@link #writeUint8(ByteBuf, Uint8)} as it is more explicit.
+ *
+ * @param buf buffer
+ * @param value A {@link Uint8}
+ * @throws NullPointerException if any argument is null
+ */
+ public static void write(final ByteBuf buf, final Uint8 value) {
+ writeUint8(buf, value);
+ }
+
+ /**
+ * Write a {@link Uint16} to specified buffer. This method is provided for convenience, you may want to use
+ * {@link #writeUint16(ByteBuf, Uint16)} as it is more explicit.
+ *
+ * @param buf buffer
+ * @param value A {@link Uint16}
+ * @throws NullPointerException if any argument is null
+ */
+ public static void write(final ByteBuf buf, final Uint16 value) {
+ writeUint16(buf, value);
+ }
+
+ /**
+ * Write a {@link Uint32} to specified buffer. This method is provided for convenience, you may want to use
+ * {@link #writeUint32(ByteBuf, Uint32)} as it is more explicit.
+ *
+ * @param buf buffer
+ * @param value A {@link Uint32}
+ * @throws NullPointerException if any argument is null
+ */
+ public static void write(final ByteBuf buf, final Uint32 value) {
+ writeUint32(buf, value);
+ }
+
+ /**
+ * Write a {@link Uint64} to specified buffer. This method is provided for convenience, you may want to use
+ * {@link #writeUint64(ByteBuf, Uint64)} as it is more explicit.
+ *
+ * @param buf buffer
+ * @param value A {@link Uint64}
+ * @throws NullPointerException if any argument is null
+ */
+ public static void write(final ByteBuf buf, final Uint64 value) {
+ writeUint64(buf, value);
+ }
+
/**
* Write a {@link Byte} property to specified buffer. If the {@code value} is known to be non-null, prefer
* {@link ByteBuf#writeByte(int)} instead of this method.
* @throws IllegalArgumentException if {@code value} is null
*/
public static void writeMandatory(final ByteBuf buf, final Integer value, final String name) {
- buf.writeInt(nonNullArgument(value, name).intValue());
+ buf.writeInt(nonNullArgument(value, name));
}
/**
* @throws IllegalArgumentException if {@code value} is null
*/
public static void writeMandatory(final ByteBuf buf, final Long value, final String name) {
- buf.writeLong(nonNullArgument(value, name).longValue());
+ buf.writeLong(nonNullArgument(value, name));
}
/**
*/
public static void writeOptional(final ByteBuf buf, final @Nullable Integer value) {
if (value != null) {
- buf.writeInt(value.intValue());
+ buf.writeInt(value);
}
}
*/
public static void writeOptional(final ByteBuf buf, final @Nullable Long value) {
if (value != null) {
- buf.writeLong(value.longValue());
+ buf.writeLong(value);
}
}
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write two zero bytes.
+ * Write a {@link Short} value to specified buffer if it is not null, otherwise write two zero bytes.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Short}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Short value) {
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write four zero bytes.
+ * Write a {@link Integer} value to specified buffer if it is not null, otherwise write four zero bytes.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Integer}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Integer value) {
- buf.writeInt(value != null ? value.intValue() : 0);
+ buf.writeInt(value != null ? value : 0);
}
/**
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Long value) {
- buf.writeLong(value != null ? value.longValue() : 0L);
+ buf.writeLong(value != null ? value : 0L);
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write one zero byte.
+ * Write a {@link Uint8} value to specified buffer if it is not null, otherwise write one zero byte.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Uint8}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Uint8 value) {
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write two zero bytes.
+ * Write a {@link Uint16} value to specified buffer if it is not null, otherwise write two zero bytes.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Uint16}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Uint16 value) {
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write four zero bytes.
+ * Write a {@link Uint32} value to specified buffer if it is not null, otherwise write four zero bytes.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Uint32}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Uint32 value) {
}
/**
- * Write a {@link Byte} value to specified buffer if it is not null, otherwise write eight zero bytes.
+ * Write a {@link Uint64} value to specified buffer if it is not null, otherwise write eight zero bytes.
*
* @param buf buffer
- * @param value A {@link Byte}
+ * @param value A {@link Uint64}
* @throws NullPointerException if {@code buf} is null
*/
public static void writeOrZero(final ByteBuf buf, final @Nullable Uint64 value) {