/** * Gets a signed data type from the buffer with the specified order. * * @param type The data type. * @param order The byte order. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. * @throws IllegalArgumentException If the combination is invalid. */ public long getSigned(DataType type, DataOrder order) { return getSigned(type, order, DataTransformation.NONE); }
/** * Puts a single bit into the buffer. If {@code flag} is {@code true}, the value of the bit is {@code 1}. If * {@code flag} is {@code false}, the value of the bit is {@code 0}. * * @param flag The flag. */ public void putBit(boolean flag) { putBit(flag ? 1 : 0); }
@Override public GamePacket encode(CloseInterfaceMessage message) { GamePacketBuilder builder = new GamePacketBuilder(219); return builder.toGamePacket(); }
/** * Puts a standard data type with the specified value. * * @param type The data type. * @param value The value. */ public void put(DataType type, Number value) { put(type, DataOrder.BIG, DataTransformation.NONE, value); }
/** * Gets an unsigned data type from the buffer. * * @param type The data type. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. */ public long getUnsigned(DataType type) { return getUnsigned(type, DataOrder.BIG, DataTransformation.NONE); }
/** * Creates the reader. * * @param packet The packet. */ public GamePacketReader(GamePacket packet) { buffer = packet.getPayload(); }
/** * Gets a bit from the buffer. * * @return The value. * @throws IllegalStateException If the reader is not in bit access mode. */ public int getBit() { return getBits(1); }
/** * Gets a signed data type from the buffer with the specified transformation. * * @param type The data type. * @param transformation The data transformation. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. * @throws IllegalArgumentException If the combination is invalid. */ public long getSigned(DataType type, DataTransformation transformation) { return getSigned(type, DataOrder.BIG, transformation); }
@Override public GamePacket encode(CloseInterfaceMessage message) { GamePacketBuilder builder = new GamePacketBuilder(29); return builder.toGamePacket(); }
/** * Puts a standard data type with the specified value and byte order. * * @param type The data type. * @param order The byte order. * @param value The value. */ public void put(DataType type, DataOrder order, Number value) { put(type, order, DataTransformation.NONE, value); }
/** * Gets an unsigned data type from the buffer with the specified order. * * @param type The data type. * @param order The byte order. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. * @throws IllegalArgumentException If the combination is invalid. */ public long getUnsigned(DataType type, DataOrder order) { return getUnsigned(type, order, DataTransformation.NONE); }
/** * Gets a signed data type from the buffer. * * @param type The data type. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. */ public long getSigned(DataType type) { return getSigned(type, DataOrder.BIG, DataTransformation.NONE); }
@Override public GamePacket encode(LogoutMessage message) { GamePacketBuilder builder = new GamePacketBuilder(109); return builder.toGamePacket(); }
/** * Puts a standard data type with the specified value and transformation. * * @param type The type. * @param transformation The transformation. * @param value The value. */ public void put(DataType type, DataTransformation transformation, Number value) { put(type, DataOrder.BIG, transformation, value); }
/** * Gets an unsigned data type from the buffer with the specified transformation. * * @param type The data type. * @param transformation The data transformation. * @return The value. * @throws IllegalStateException If this reader is not in byte access mode. * @throws IllegalArgumentException If the combination is invalid. */ public long getUnsigned(DataType type, DataTransformation transformation) { return getUnsigned(type, DataOrder.BIG, transformation); }
/** * Puts a single bit into the buffer with the value {@code value}. * * @param value The value. */ public void putBit(int value) { putBits(1, value); }