Class SinglePacketBuffer
- java.lang.Object
-
- io.github.joealisson.mmocore.internal.SinglePacketBuffer
-
- All Implemented Interfaces:
Buffer,ReadableBuffer
public class SinglePacketBuffer extends java.lang.Object implements ReadableBuffer
-
-
Constructor Summary
Constructors Constructor Description SinglePacketBuffer(java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intlimit()voidlimit(int newLimit)Change the buffer's limitbytereadByte()Reads raw byte from the bufferbytereadByte(int index)Read byte from the buffer at index.voidreadBytes(byte[] dst)voidreadBytes(byte[] dst, int offset, int length)charreadChar()doublereadDouble()floatreadFloat()intreadInt()Reads int from the buffer.intreadInt(int index)Read int from the buffer at index.longreadLong()shortreadShort()Reads short from the buffer.shortreadShort(int index)Read short from the buffer at index.intremaining()voidwriteByte(int index, byte value)Write byte to the buffer at index.voidwriteInt(int index, int value)Write int to the buffer at index.voidwriteShort(int index, short value)Write int to the buffer at index.
-
-
-
Method Detail
-
readByte
public byte readByte()
Description copied from interface:ReadableBufferReads raw byte from the buffer- Specified by:
readBytein interfaceReadableBuffer- Returns:
- byte read
-
readShort
public short readShort()
Description copied from interface:ReadableBufferReads short from the buffer.
16bit integer (00 00)- Specified by:
readShortin interfaceReadableBuffer- Returns:
- short read
-
readChar
public char readChar()
- Specified by:
readCharin interfaceReadableBuffer
-
readInt
public int readInt()
Description copied from interface:ReadableBufferReads int from the buffer.
32bit integer (00 00 00 00)- Specified by:
readIntin interfaceReadableBuffer- Returns:
- int read
-
readFloat
public float readFloat()
- Specified by:
readFloatin interfaceReadableBuffer
-
readLong
public long readLong()
- Specified by:
readLongin interfaceReadableBuffer
-
readDouble
public double readDouble()
- Specified by:
readDoublein interfaceReadableBuffer
-
readBytes
public void readBytes(byte[] dst)
- Specified by:
readBytesin interfaceReadableBuffer
-
readBytes
public void readBytes(byte[] dst, int offset, int length)- Specified by:
readBytesin interfaceReadableBuffer
-
remaining
public int remaining()
- Specified by:
remainingin interfaceReadableBuffer
-
readByte
public byte readByte(int index)
Description copied from interface:BufferRead byte from the buffer at index.
8bit integer (00)
-
writeByte
public void writeByte(int index, byte value)Description copied from interface:BufferWrite byte to the buffer at index.
8bit integer (00)
-
readShort
public short readShort(int index)
Description copied from interface:BufferRead short from the buffer at index.
16bit integer (00 00)
-
writeShort
public void writeShort(int index, short value)Description copied from interface:BufferWrite int to the buffer at index.
16bit integer (00 00)- Specified by:
writeShortin interfaceBuffer- Parameters:
index- index to write tovalue- to be written
-
limit
public void limit(int newLimit)
Description copied from interface:BufferChange the buffer's limit
-
readInt
public int readInt(int index)
Description copied from interface:BufferRead int from the buffer at index.
32bit integer (00 00 00 00)
-
-