Package io.grpc.netty
Class NettyWritableBuffer
- java.lang.Object
-
- io.grpc.netty.NettyWritableBuffer
-
- All Implemented Interfaces:
WritableBuffer
class NettyWritableBuffer extends java.lang.Object implements WritableBuffer
TheWritableBufferused by the Netty transport.
-
-
Field Summary
Fields Modifier and Type Field Description private io.netty.buffer.ByteBufbytebuf
-
Constructor Summary
Constructors Constructor Description NettyWritableBuffer(io.netty.buffer.ByteBuf bytebuf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) io.netty.buffer.ByteBufbytebuf()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
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
-
bytebuf
io.netty.buffer.ByteBuf bytebuf()
-
-