public class ByteBufUtils
extends java.lang.Object
ByteBuf.| Constructor and Description |
|---|
ByteBufUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getContentDump(ByteBuf buffer) |
static ItemStack |
readItemStack(ByteBuf from)
Read an
ItemStack from the byte buffer provided. |
static NBTTagCompound |
readTag(ByteBuf from)
Read an
NBTTagCompound from the byte buffer. |
static java.lang.String |
readUTF8String(ByteBuf from)
Read a UTF8 string from the byte buffer.
|
static int |
readVarInt(ByteBuf buf,
int maxSize)
Read a varint from the supplied buffer.
|
static int |
readVarShort(ByteBuf buf)
An extended length short.
|
static int |
varIntByteCount(int toCount)
The number of bytes to write the supplied int using the 7 bit varint encoding.
|
static void |
writeItemStack(ByteBuf to,
ItemStack stack)
Write an
ItemStack using minecraft compatible encoding. |
static void |
writeTag(ByteBuf to,
NBTTagCompound tag)
Write an
NBTTagCompound to the byte buffer. |
static void |
writeUTF8String(ByteBuf to,
java.lang.String string)
Write a String with UTF8 byte encoding to the buffer.
|
static void |
writeVarInt(ByteBuf to,
int toWrite,
int maxSize)
Write an integer to the buffer using variable length encoding.
|
static void |
writeVarShort(ByteBuf buf,
int toWrite) |
public static int varIntByteCount(int toCount)
toCount - The number to analysepublic static int readVarInt(ByteBuf buf,
int maxSize)
buf - The buffer to read frommaxSize - The maximum length of bytes to readpublic static int readVarShort(ByteBuf buf)
buf - public static void writeVarShort(ByteBuf buf,
int toWrite)
public static void writeVarInt(ByteBuf to,
int toWrite,
int maxSize)
to - The buffer to write totoWrite - The integer to writemaxSize - The maximum number of bytes to usepublic static java.lang.String readUTF8String(ByteBuf from)
from - The buffer to read frompublic static void writeUTF8String(ByteBuf to,
java.lang.String string)
to - the buffer to write tostring - The string to writepublic static void writeItemStack(ByteBuf to,
ItemStack stack)
ItemStack using minecraft compatible encoding.to - The buffer to write tostack - The itemstack to writepublic static ItemStack readItemStack(ByteBuf from)
ItemStack from the byte buffer provided. It uses the minecraft encoding.from - The buffer to read frompublic static void writeTag(ByteBuf to,
NBTTagCompound tag)
NBTTagCompound to the byte buffer. It uses the minecraft encoding.to - The buffer to write totag - The tag to writepublic static NBTTagCompound readTag(ByteBuf from)
NBTTagCompound from the byte buffer. It uses the minecraft encoding.from - The buffer to read frompublic static java.lang.String getContentDump(ByteBuf buffer)