Class ServletServerStream.ByteArrayWritableBuffer
java.lang.Object
io.grpc.servlet.ServletServerStream.ByteArrayWritableBuffer
- All Implemented Interfaces:
WritableBuffer
- Enclosing class:
ServletServerStream
private static final class ServletServerStream.ByteArrayWritableBuffer
extends Object
implements WritableBuffer
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of bytes one can read from the buffer.voidrelease()Releases the buffer, indicating to theWritableBufferAllocatorthat this buffer is no longer used and its resources can be reused.intReturns the number of bytes one can write to the buffer.voidwrite(byte b) Appends a single byte to the buffer.voidwrite(byte[] src, int srcIndex, int length) Appendslengthbytes to the buffer from the source array starting atsrcIndex.
-
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:WritableBufferAppendslengthbytes to the buffer from the source array starting atsrcIndex.- Specified by:
writein interfaceWritableBuffer
-
write
public void write(byte b) Description copied from interface:WritableBufferAppends a single byte to the buffer. This is slow so don't call it.- Specified by:
writein interfaceWritableBuffer
-
writableBytes
public int writableBytes()Description copied from interface:WritableBufferReturns the number of bytes one can write to the buffer.- Specified by:
writableBytesin interfaceWritableBuffer
-
readableBytes
public int readableBytes()Description copied from interface:WritableBufferReturns the number of bytes one can read from the buffer.- Specified by:
readableBytesin interfaceWritableBuffer
-
release
public void release()Description copied from interface:WritableBufferReleases the buffer, indicating to theWritableBufferAllocatorthat this buffer is no longer used and its resources can be reused.- Specified by:
releasein interfaceWritableBuffer
-