Class BufUnwrapper

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    final class BufUnwrapper
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Unwraps ByteBufs into ByteBuffers.
    • Constructor Summary

      Constructors 
      Constructor Description
      BufUnwrapper()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      private static java.nio.ByteBuffer[] nioBuffers​(io.netty.buffer.ByteBuf buf, java.nio.ByteBuffer[] singleBuffer)
      Optimized accessor for obtaining the underlying NIO buffers for a Netty ByteBuf.
      (package private) java.nio.ByteBuffer[] readableNioBuffers​(io.netty.buffer.ByteBuf buf)
      Called to get access to the underlying NIO buffers for a ByteBuf that will be used for reading.
      (package private) java.nio.ByteBuffer[] writableNioBuffers​(io.netty.buffer.ByteBuf buf)
      Called to get access to the underlying NIO buffers for a ByteBuf that will be used for writing.
      • Methods inherited from class java.lang.Object

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

      • singleReadBuffer

        private final java.nio.ByteBuffer[] singleReadBuffer
      • singleWriteBuffer

        private final java.nio.ByteBuffer[] singleWriteBuffer
    • Constructor Detail

      • BufUnwrapper

        BufUnwrapper()
    • Method Detail

      • writableNioBuffers

        java.nio.ByteBuffer[] writableNioBuffers​(io.netty.buffer.ByteBuf buf)
        Called to get access to the underlying NIO buffers for a ByteBuf that will be used for writing.
      • readableNioBuffers

        java.nio.ByteBuffer[] readableNioBuffers​(io.netty.buffer.ByteBuf buf)
        Called to get access to the underlying NIO buffers for a ByteBuf that will be used for reading.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • nioBuffers

        private static java.nio.ByteBuffer[] nioBuffers​(io.netty.buffer.ByteBuf buf,
                                                        java.nio.ByteBuffer[] singleBuffer)
        Optimized accessor for obtaining the underlying NIO buffers for a Netty ByteBuf. Based on code from Netty's SslHandler. This method returns NIO buffers that span the readable region of the ByteBuf.