Class IoUringFileRegion

java.lang.Object
io.netty.channel.uring.IoUringFileRegion
All Implemented Interfaces:
FileRegion, ReferenceCounted

final class IoUringFileRegion extends Object implements FileRegion
  • Field Details

  • Constructor Details

  • Method Details

    • open

      void open() throws IOException
      Throws:
      IOException
    • splice

      IoUringIoOps splice(int fd)
    • spliceToPipe

      IoUringIoOps spliceToPipe()
    • spliceToSocket

      private IoUringIoOps spliceToSocket(int socket, int len)
    • handleResult

      int handleResult(int result, short data)
      Handle splice result
      Parameters:
      result - the result
      data - the data that was submitted as part of the SPLICE.
      Returns:
      the number of bytes that should be considered to be transferred.
    • position

      public long position()
      Description copied from interface: FileRegion
      Returns the offset in the file where the transfer began.
      Specified by:
      position in interface FileRegion
    • transfered

      public long transfered()
      Description copied from interface: FileRegion
      Returns the bytes which was transferred already.
      Specified by:
      transfered in interface FileRegion
    • transferred

      public long transferred()
      Description copied from interface: FileRegion
      Returns the bytes which was transferred already.

      Note: some asynchronous transports (such as the io_uring transport when falling back to a chunked send for non-DefaultFileRegion implementations) advance this counter when bytes have been queued for submission, which may be before they reach the peer. If the channel is closed or the write fails after queuing, the reported value may overstate the number of bytes actually delivered.

      Specified by:
      transferred in interface FileRegion
    • count

      public long count()
      Description copied from interface: FileRegion
      Returns the number of bytes to transfer.
      Specified by:
      count in interface FileRegion
    • transferTo

      public long transferTo(WritableByteChannel target, long position)
      Description copied from interface: FileRegion
      Transfers the content of this file region to the specified channel.
      Specified by:
      transferTo in interface FileRegion
      Parameters:
      target - the destination of the transfer
      position - the relative offset of the file where the transfer begins from. For example, 0 will make the transfer start from FileRegion.position()th byte and FileRegion.count() - 1 will make the last byte of the region transferred.
    • retain

      public FileRegion retain()
      Description copied from interface: ReferenceCounted
      Increases the reference count by 1.
      Specified by:
      retain in interface FileRegion
      Specified by:
      retain in interface ReferenceCounted
    • retain

      public FileRegion retain(int increment)
      Description copied from interface: ReferenceCounted
      Increases the reference count by the specified increment.
      Specified by:
      retain in interface FileRegion
      Specified by:
      retain in interface ReferenceCounted
    • touch

      public FileRegion touch()
      Description copied from interface: ReferenceCounted
      Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).
      Specified by:
      touch in interface FileRegion
      Specified by:
      touch in interface ReferenceCounted
    • touch

      public FileRegion touch(Object hint)
      Description copied from interface: ReferenceCounted
      Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.
      Specified by:
      touch in interface FileRegion
      Specified by:
      touch in interface ReferenceCounted
    • refCnt

      public int refCnt()
      Description copied from interface: ReferenceCounted
      Returns the reference count of this object. If 0, it means this object has been deallocated.
      Specified by:
      refCnt in interface ReferenceCounted
    • release

      public boolean release()
      Description copied from interface: ReferenceCounted
      Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Returns:
      true if and only if the reference count became 0 and this object has been deallocated
    • release

      public boolean release(int decrement)
      Description copied from interface: ReferenceCounted
      Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
      Specified by:
      release in interface ReferenceCounted
      Returns:
      true if and only if the reference count became 0 and this object has been deallocated
    • closePipeIfNeeded

      private void closePipeIfNeeded()
    • closeSilently

      private static void closeSilently(FileDescriptor fd)