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 <T extends IForgeRegistryEntry<T>> | 
readRegistryEntries(ByteBuf in,
                   IForgeRegistry<T> registry)
Read multiple registry entries from the same registries from the stream. 
 | 
static <T extends IForgeRegistryEntry<T>> | 
readRegistryEntry(ByteBuf in,
                 IForgeRegistry<T> registry)
Read a registry entry from the stream. 
 | 
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 <T extends IForgeRegistryEntry<T>> | 
writeRegistryEntries(ByteBuf out,
                    java.util.Collection<T> entries)
Write multiple registry entries from the same registry to the stream. 
 | 
static <T extends IForgeRegistryEntry<T>> | 
writeRegistryEntry(ByteBuf out,
                  T entry)
Write a registry entry to the stream. 
 | 
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 <T extends IForgeRegistryEntry<T>> void writeRegistryEntry(ByteBuf out, T entry)
out - the buffer to write toentry - the registry entrypublic static <T extends IForgeRegistryEntry<T>> T readRegistryEntry(ByteBuf in, IForgeRegistry<T> registry)
writeRegistryEntry(ByteBuf, IForgeRegistryEntry) is used.in - the buffer to read fromregistry - the registry the entry belongs topublic static <T extends IForgeRegistryEntry<T>> void writeRegistryEntries(ByteBuf out, java.util.Collection<T> entries)
writeRegistryEntry(ByteBuf, IForgeRegistryEntry) multiple times.out - the buffer to write toentries - the entries to writepublic static <T extends IForgeRegistryEntry<T>> java.util.List<T> readRegistryEntries(ByteBuf in, IForgeRegistry<T> registry)
writeRegistryEntries(ByteBuf, Collection).in - the buffer to read fromregistry - the registry the entries belong topublic static java.lang.String getContentDump(ByteBuf buffer)