类 NBukkitByteBuf

java.lang.Object
cn.afternode.commons.bukkit.messaging.NBukkitByteBuf

public class NBukkitByteBuf extends Object
Netty version of BukkitByteBuffer
No need to shade netty, it's provided by server
  • 构造器详细资料

    • NBukkitByteBuf

      public NBukkitByteBuf(byte[] data)
    • NBukkitByteBuf

      public NBukkitByteBuf()
  • 方法详细资料

    • read

      public void read(byte[] dest)
      Read byte array
      参数:
      dest - Destination
    • write

      public void write(byte[] data)
      Write byte array
      参数:
      data - Data
    • read

      public byte[] read(int size)
      Read byte array with specified size
      参数:
      size - Size
      返回:
      Result
    • readBlock

      public byte[] readBlock()
      Read byte array in a block
      返回:
      Result
    • writeBlock

      public void writeBlock(byte[] data)
      Write byte array in a block
      参数:
      data - Block
    • readBlockL

      public byte[] readBlockL()
      Read byte array in a large block
      返回:
      Result
    • writeBlockL

      public void writeBlockL(byte[] data)
      Write byte array in a large block
      参数:
      data - Data
    • readShort

      public short readShort()
      Read short
      返回:
      result
    • writeShort

      public void writeShort(short data)
      Write short
      参数:
      data - data
    • readInt

      public int readInt()
      Read integer
      返回:
      result
    • writeInt

      public void writeInt(int data)
      Write integer
      参数:
      data - result
    • readLong

      public long readLong()
      Read long integer
      返回:
      result
    • writeLong

      public void writeLong(long data)
      Write long integer
      参数:
      data - data
    • readString

      public String readString()
      Read UTF-8 String
      返回:
      result
    • writeString

      public void writeString(String data)
      Write UTF-8 string
      参数:
      data - data
    • writeEnum

      public void writeEnum(Enum<?> e)
      Write enumeration object (1 short integer)
      参数:
      e - object
    • readEnum

      public <T extends Enum<?>> T readEnum(Class<T> clazz)
      Read enumeration object (1 short integer)
      类型参数:
      T - Type
      参数:
      clazz - Type
      返回:
      result
    • readUUID

      public UUID readUUID()
      Read UUID (2 long integers)
      返回:
      result
    • writeUUID

      public void writeUUID(UUID uuid)
      Write UUID (2 long integers)
      参数:
      uuid - object
    • readPlayer

      public org.bukkit.entity.Player readPlayer()
      Read player (UUID)
      返回:
      result (online only)
    • readPlayerOffline

      public org.bukkit.OfflinePlayer readPlayerOffline()
      Read player (UUID)
      返回:
      result (online or offline)
    • writePlayer

      public void writePlayer(org.bukkit.OfflinePlayer player)
      Write player (UUID)
      参数:
      player - result
    • readItemStack

      public org.bukkit.inventory.ItemStack readItemStack() throws IOException, ClassNotFoundException
      Read item stack with BukkitObjectInputStream
      返回:
      result
      抛出:
      IOException - ObjectInputStream error
      ClassNotFoundException - ObjectInputStream error
      另请参阅:
      • BukkitObjectInputStream
    • writeItemStack

      public void writeItemStack(org.bukkit.inventory.ItemStack item) throws IOException
      Write item stack with BukkitObjectOutputStream
      参数:
      item - item
      抛出:
      IOException - ObjectInputStream error
      另请参阅:
      • BukkitObjectInputStream
    • direct

      public io.netty.buffer.ByteBuf direct()
      Access to source netty ByteBuf directly
      返回:
      source
    • toArray

      public byte[] toArray()
      Convert to byte array
      返回:
      result