Package io.github.joealisson.mmocore
Class DataWrapper
- java.lang.Object
-
- io.github.joealisson.mmocore.AbstractPacket<T>
-
- io.github.joealisson.mmocore.ReadablePacket<java.lang.Object>
-
- io.github.joealisson.mmocore.DataWrapper
-
- All Implemented Interfaces:
java.lang.Runnable
public final class DataWrapper extends ReadablePacket<java.lang.Object>
This class is a data wrapper that supply a basic interface that facilitates the reading of the incoming data.
-
-
Field Summary
-
Fields inherited from class io.github.joealisson.mmocore.AbstractPacket
client
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()byte[]expose()byteget()get the next byte from the underlying data.intgetInt()get the next integer from the underlying data.shortgetShort()get the next short from the underlying dataprotected booleanread()voidrun()-
Methods inherited from class io.github.joealisson.mmocore.ReadablePacket
availableData, readByte, readBytes, readBytes, readChar, readDouble, readFloat, readInt, readLong, readShort, readSizedString, readString, readUnsignedByte
-
Methods inherited from class io.github.joealisson.mmocore.AbstractPacket
getClient
-
-
-
-
Method Detail
-
read
protected boolean read()
- Specified by:
readin classReadablePacket<java.lang.Object>
-
run
public void run()
- Throws:
java.lang.UnsupportedOperationException- - this method does nothing just throw
-
get
public byte get()
get the next byte from the underlying data.- Returns:
- the next byte
-
getShort
public short getShort()
get the next short from the underlying data- Returns:
- the next short
-
getInt
public int getInt()
get the next integer from the underlying data.- Returns:
- the next integer
-
available
public int available()
- Returns:
- the length in bytes of the remaining data.
-
expose
public byte[] expose()
- Returns:
- the underlying data
-
-