Package io.github.joealisson.mmocore
Interface Buffer
-
- All Known Subinterfaces:
ReadableBuffer
- All Known Implementing Classes:
ArrayPacketBuffer,DynamicPacketBuffer,InternalWritableBuffer,SinglePacketBuffer,WritableBuffer
public interface Buffer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intlimit()voidlimit(int newLimit)Change the buffer's limitbytereadByte(int index)Read byte from the buffer at index.intreadInt(int index)Read int from the buffer at index.shortreadShort(int index)Read short from the buffer at index.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
byte readByte(int index)
Read byte from the buffer at index.
8bit integer (00)- Parameters:
index- index to read from- Returns:
- the byte value at the index.
-
writeByte
void writeByte(int index, byte value)Write byte to the buffer at index.
8bit integer (00)- Parameters:
index- index to write tovalue- to be written
-
readShort
short readShort(int index)
Read short from the buffer at index.
16bit integer (00 00)- Parameters:
index- index to read from- Returns:
- the short value at index.
-
writeShort
void writeShort(int index, short value)Write int to the buffer at index.
16bit integer (00 00)- Parameters:
index- index to write tovalue- to be written
-
readInt
int readInt(int index)
Read int from the buffer at index.
32bit integer (00 00 00 00)- Parameters:
index- index to read from- Returns:
- the int value at index.
-
writeInt
void writeInt(int index, int value)Write int to the buffer at index.
32bit integer (00 00 00 00)- Parameters:
index- index to write tovalue- to be written
-
limit
int limit()
- Returns:
- the buffer's limit
-
limit
void limit(int newLimit)
Change the buffer's limit- Parameters:
newLimit- the new limit
-
-