Package io.grpc.netty

Class NettyWritableBuffer

java.lang.Object
io.grpc.netty.NettyWritableBuffer
All Implemented Interfaces:
WritableBuffer

class NettyWritableBuffer extends Object implements WritableBuffer
The WritableBuffer used by the Netty transport.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final io.netty.buffer.ByteBuf
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyWritableBuffer(io.netty.buffer.ByteBuf bytebuf)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) io.netty.buffer.ByteBuf
     
    int
    Returns the number of bytes one can read from the buffer.
    void
    Releases the buffer, indicating to the WritableBufferAllocator that this buffer is no longer used and its resources can be reused.
    int
    Returns the number of bytes one can write to the buffer.
    void
    write(byte b)
    Appends a single byte to the buffer.
    void
    write(byte[] src, int srcIndex, int length)
    Appends length bytes to the buffer from the source array starting at srcIndex.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bytebuf

      private final io.netty.buffer.ByteBuf bytebuf
  • Constructor Details

    • NettyWritableBuffer

      NettyWritableBuffer(io.netty.buffer.ByteBuf bytebuf)
  • Method Details

    • write

      public void write(byte[] src, int srcIndex, int length)
      Description copied from interface: WritableBuffer
      Appends length bytes to the buffer from the source array starting at srcIndex.
      Specified by:
      write in interface WritableBuffer
    • write

      public void write(byte b)
      Description copied from interface: WritableBuffer
      Appends a single byte to the buffer. This is slow so don't call it.
      Specified by:
      write in interface WritableBuffer
    • writableBytes

      public int writableBytes()
      Description copied from interface: WritableBuffer
      Returns the number of bytes one can write to the buffer.
      Specified by:
      writableBytes in interface WritableBuffer
    • readableBytes

      public int readableBytes()
      Description copied from interface: WritableBuffer
      Returns the number of bytes one can read from the buffer.
      Specified by:
      readableBytes in interface WritableBuffer
    • release

      public void release()
      Description copied from interface: WritableBuffer
      Releases the buffer, indicating to the WritableBufferAllocator that this buffer is no longer used and its resources can be reused.
      Specified by:
      release in interface WritableBuffer
    • bytebuf

      io.netty.buffer.ByteBuf bytebuf()