Package io.grpc.internal
Interface WritableBuffer
-
- All Known Implementing Classes:
NettyWritableBuffer,ServletServerStream.ByteArrayWritableBuffer,ServletServerStream.ByteArrayWritableBuffer
public interface WritableBufferAn interface for a byte buffer that can only be written to.WritableBuffers are a generic way to transfer bytes to the concrete network transports, like Netty and OkHttp.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intreadableBytes()Returns 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.intwritableBytes()Returns 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.
-
-
-
Method Detail
-
write
void write(byte[] src, int srcIndex, int length)Appendslengthbytes to the buffer from the source array starting atsrcIndex.- Throws:
java.lang.IndexOutOfBoundsException- if the specifiedsrcIndexis less than0, ifsrcIndex + lengthis greater thansrc.length, or iflengthis greater thanwritableBytes()
-
write
void write(byte b)
Appends a single byte to the buffer. This is slow so don't call it.
-
writableBytes
int writableBytes()
Returns the number of bytes one can write to the buffer.
-
readableBytes
int readableBytes()
Returns the number of bytes one can read from the buffer.
-
release
void release()
Releases the buffer, indicating to theWritableBufferAllocatorthat this buffer is no longer used and its resources can be reused.
-
-