Class NettyByteBufAdapter

java.lang.Object
io.netty.buffer.ByteBuf
io.netty.buffer.AbstractByteBuf
com.comphenix.protocol.injector.netty.NettyByteBufAdapter
All Implemented Interfaces:
io.netty.util.ReferenceCounted, Comparable<io.netty.buffer.ByteBuf>

public class NettyByteBufAdapter extends io.netty.buffer.AbstractByteBuf
Construct a ByteBuf around an input stream and an output stream.

Note that as streams usually don't support seeking, this implementation will ignore all indexing in the byte buffer.

  • Method Summary

    Modifier and Type
    Method
    Description
    protected byte
    _getByte(int paramInt)
     
    protected int
    _getInt(int paramInt)
     
    protected int
    _getIntLE(int arg0)
     
    protected long
    _getLong(int paramInt)
     
    protected long
    _getLongLE(int arg0)
     
    protected short
    _getShort(int paramInt)
     
    protected short
    _getShortLE(int arg0)
     
    protected int
    _getUnsignedMedium(int paramInt)
     
    protected int
     
    protected void
    _setByte(int index, int value)
     
    protected void
    _setInt(int index, int value)
     
    protected void
    _setIntLE(int arg0, int arg1)
     
    protected void
    _setLong(int index, long value)
     
    protected void
    _setLongLE(int arg0, long arg1)
     
    protected void
    _setMedium(int index, int value)
     
    protected void
    _setMediumLE(int arg0, int arg1)
     
    protected void
    _setShort(int index, int value)
     
    protected void
    _setShortLE(int arg0, int arg1)
     
    io.netty.buffer.ByteBufAllocator
     
    byte[]
     
    int
     
    int
     
    io.netty.buffer.ByteBuf
    capacity(int paramInt)
     
    io.netty.buffer.ByteBuf
    copy(int index, int length)
     
    io.netty.buffer.ByteBuf
    getBytes(int index, byte[] dst, int dstIndex, int length)
     
    io.netty.buffer.ByteBuf
    getBytes(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length)
     
    io.netty.buffer.ByteBuf
    getBytes(int index, OutputStream dst, int length)
     
    io.netty.buffer.ByteBuf
    getBytes(int index, ByteBuffer dst)
     
    int
    getBytes(int arg0, FileChannel arg1, long arg2, int arg3)
     
    int
    getBytes(int index, GatheringByteChannel out, int length)
     
    boolean
     
    boolean
     
    internalNioBuffer(int paramInt1, int paramInt2)
     
    boolean
     
    long
     
    nioBuffer(int paramInt1, int paramInt2)
     
    int
     
    nioBuffers(int paramInt1, int paramInt2)
     
     
    static io.netty.buffer.ByteBuf
    Construct a new Minecraft packet serializer using the current byte buf adapter.
    static io.netty.buffer.ByteBuf
    Construct a new Minecraft packet deserializer using the current byte buf adapter.
    int
     
    boolean
     
    boolean
    release(int paramInt)
     
    io.netty.buffer.ByteBuf
     
    io.netty.buffer.ByteBuf
    retain(int paramInt)
     
    io.netty.buffer.ByteBuf
    setBytes(int index, byte[] src, int srcIndex, int length)
     
    io.netty.buffer.ByteBuf
    setBytes(int index, io.netty.buffer.ByteBuf src, int srcIndex, int length)
     
    int
    setBytes(int index, InputStream in, int length)
     
    io.netty.buffer.ByteBuf
    setBytes(int index, ByteBuffer src)
     
    int
    setBytes(int arg0, FileChannel arg1, long arg2, int arg3)
     
    int
    setBytes(int index, ScatteringByteChannel in, int length)
     
    io.netty.buffer.ByteBuf
     
    io.netty.buffer.ByteBuf
    touch(Object arg0)
     
    io.netty.buffer.ByteBuf
     

    Methods inherited from class io.netty.buffer.AbstractByteBuf

    adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkIndex, checkIndex, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardReadBytes, discardSomeReadBytes, duplicate, ensureAccessible, ensureWritable, ensureWritable, equals, forEachByte, forEachByte, forEachByteDesc, forEachByteDesc, getBoolean, getByte, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getInt, getLong, getMedium, getShort, getUnsignedByte, getUnsignedInt, getUnsignedMedium, getUnsignedShort, hashCode, indexOf, isReadable, isReadable, isWritable, isWritable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readDouble, readerIndex, readerIndex, readFloat, readInt, readLong, readMedium, readShort, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedMedium, readUnsignedShort, resetReaderIndex, resetWriterIndex, setBoolean, setByte, setBytes, setBytes, setBytes, setChar, setDouble, setFloat, setIndex, setInt, setLong, setMedium, setShort, setZero, skipBytes, slice, slice, toString, toString, toString, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeDouble, writeFloat, writeInt, writeLong, writeMedium, writerIndex, writerIndex, writeShort, writeZero

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • packetReader

      public static io.netty.buffer.ByteBuf packetReader(DataInputStream input)
      Construct a new Minecraft packet serializer using the current byte buf adapter.
      Parameters:
      input - - the input stream.
      Returns:
      A packet serializer with a wrapped byte buf adapter.
    • packetWriter

      public static io.netty.buffer.ByteBuf packetWriter(DataOutputStream output)
      Construct a new Minecraft packet deserializer using the current byte buf adapter.
      Parameters:
      output - - the output stream.
      Returns:
      A packet serializer with a wrapped byte buf adapter.
    • refCnt

      public int refCnt()
    • release

      public boolean release()
    • release

      public boolean release(int paramInt)
    • _getByte

      protected byte _getByte(int paramInt)
      Specified by:
      _getByte in class io.netty.buffer.AbstractByteBuf
    • _getShort

      protected short _getShort(int paramInt)
      Specified by:
      _getShort in class io.netty.buffer.AbstractByteBuf
    • _getUnsignedMedium

      protected int _getUnsignedMedium(int paramInt)
      Specified by:
      _getUnsignedMedium in class io.netty.buffer.AbstractByteBuf
    • _getInt

      protected int _getInt(int paramInt)
      Specified by:
      _getInt in class io.netty.buffer.AbstractByteBuf
    • _getLong

      protected long _getLong(int paramInt)
      Specified by:
      _getLong in class io.netty.buffer.AbstractByteBuf
    • _setByte

      protected void _setByte(int index, int value)
      Specified by:
      _setByte in class io.netty.buffer.AbstractByteBuf
    • _setShort

      protected void _setShort(int index, int value)
      Specified by:
      _setShort in class io.netty.buffer.AbstractByteBuf
    • _setMedium

      protected void _setMedium(int index, int value)
      Specified by:
      _setMedium in class io.netty.buffer.AbstractByteBuf
    • _setInt

      protected void _setInt(int index, int value)
      Specified by:
      _setInt in class io.netty.buffer.AbstractByteBuf
    • _setLong

      protected void _setLong(int index, long value)
      Specified by:
      _setLong in class io.netty.buffer.AbstractByteBuf
    • capacity

      public int capacity()
      Specified by:
      capacity in class io.netty.buffer.ByteBuf
    • capacity

      public io.netty.buffer.ByteBuf capacity(int paramInt)
      Specified by:
      capacity in class io.netty.buffer.ByteBuf
    • alloc

      public io.netty.buffer.ByteBufAllocator alloc()
      Specified by:
      alloc in class io.netty.buffer.ByteBuf
    • order

      public ByteOrder order()
      Specified by:
      order in class io.netty.buffer.ByteBuf
    • unwrap

      public io.netty.buffer.ByteBuf unwrap()
      Specified by:
      unwrap in class io.netty.buffer.ByteBuf
    • isDirect

      public boolean isDirect()
      Specified by:
      isDirect in class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, io.netty.buffer.ByteBuf dst, int dstIndex, int length)
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length)
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, ByteBuffer dst)
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
    • getBytes

      public io.netty.buffer.ByteBuf getBytes(int index, OutputStream dst, int length) throws IOException
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • getBytes

      public int getBytes(int index, GatheringByteChannel out, int length) throws IOException
      Specified by:
      getBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, io.netty.buffer.ByteBuf src, int srcIndex, int length)
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, byte[] src, int srcIndex, int length)
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
    • setBytes

      public io.netty.buffer.ByteBuf setBytes(int index, ByteBuffer src)
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
    • setBytes

      public int setBytes(int index, InputStream in, int length) throws IOException
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • setBytes

      public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException
      Specified by:
      setBytes in class io.netty.buffer.ByteBuf
      Throws:
      IOException
    • copy

      public io.netty.buffer.ByteBuf copy(int index, int length)
      Specified by:
      copy in class io.netty.buffer.ByteBuf
    • nioBufferCount

      public int nioBufferCount()
      Specified by:
      nioBufferCount in class io.netty.buffer.ByteBuf
    • nioBuffer

      public ByteBuffer nioBuffer(int paramInt1, int paramInt2)
      Specified by:
      nioBuffer in class io.netty.buffer.ByteBuf
    • internalNioBuffer

      public ByteBuffer internalNioBuffer(int paramInt1, int paramInt2)
      Specified by:
      internalNioBuffer in class io.netty.buffer.ByteBuf
    • nioBuffers

      public ByteBuffer[] nioBuffers(int paramInt1, int paramInt2)
      Specified by:
      nioBuffers in class io.netty.buffer.ByteBuf
    • hasArray

      public boolean hasArray()
      Specified by:
      hasArray in class io.netty.buffer.ByteBuf
    • array

      public byte[] array()
      Specified by:
      array in class io.netty.buffer.ByteBuf
    • arrayOffset

      public int arrayOffset()
      Specified by:
      arrayOffset in class io.netty.buffer.ByteBuf
    • hasMemoryAddress

      public boolean hasMemoryAddress()
      Specified by:
      hasMemoryAddress in class io.netty.buffer.ByteBuf
    • memoryAddress

      public long memoryAddress()
      Specified by:
      memoryAddress in class io.netty.buffer.ByteBuf
    • retain

      public io.netty.buffer.ByteBuf retain(int paramInt)
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Specified by:
      retain in class io.netty.buffer.ByteBuf
    • retain

      public io.netty.buffer.ByteBuf retain()
      Specified by:
      retain in interface io.netty.util.ReferenceCounted
      Specified by:
      retain in class io.netty.buffer.ByteBuf
    • _getIntLE

      protected int _getIntLE(int arg0)
    • _getLongLE

      protected long _getLongLE(int arg0)
    • _getShortLE

      protected short _getShortLE(int arg0)
    • _getUnsignedMediumLE

      protected int _getUnsignedMediumLE(int arg0)
    • _setIntLE

      protected void _setIntLE(int arg0, int arg1)
    • _setLongLE

      protected void _setLongLE(int arg0, long arg1)
    • _setMediumLE

      protected void _setMediumLE(int arg0, int arg1)
    • _setShortLE

      protected void _setShortLE(int arg0, int arg1)
    • getBytes

      public int getBytes(int arg0, FileChannel arg1, long arg2, int arg3) throws IOException
      Throws:
      IOException
    • setBytes

      public int setBytes(int arg0, FileChannel arg1, long arg2, int arg3)
    • touch

      public io.netty.buffer.ByteBuf touch()
    • touch

      public io.netty.buffer.ByteBuf touch(Object arg0)