Class ServletServerStream.ByteArrayWritableBuffer

java.lang.Object
io.grpc.servlet.jakarta.ServletServerStream.ByteArrayWritableBuffer
All Implemented Interfaces:
WritableBuffer
Enclosing class:
ServletServerStream

private static final class ServletServerStream.ByteArrayWritableBuffer extends Object implements WritableBuffer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final byte[]
     
    private final int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ByteArrayWritableBuffer(int capacityHint)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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

    • capacity

      private final int capacity
    • bytes

      final byte[] bytes
    • index

      private int index
  • Constructor Details

    • ByteArrayWritableBuffer

      ByteArrayWritableBuffer(int capacityHint)
  • 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