Class IoUringFileRegion
java.lang.Object
io.netty.channel.uring.IoUringFileRegion
- All Implemented Interfaces:
FileRegion, ReferenceCounted
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final DefaultFileRegionprivate static final InternalLoggerprivate FileDescriptor[]private intprivate static final shortprivate static final shortprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate static voidlongcount()Returns the number of bytes to transfer.(package private) inthandleResult(int result, short data) Handle splice result(package private) voidopen()longposition()Returns the offset in the file where the transfer began.intrefCnt()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.booleanrelease(int decrement) Decreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.retain()Increases the reference count by1.retain(int increment) Increases the reference count by the specifiedincrement.(package private) IoUringIoOpssplice(int fd) (package private) IoUringIoOpsprivate IoUringIoOpsspliceToSocket(int socket, int len) touch()Records the current access location of this object for debugging purposes.Records the current access location of this object with an additional arbitrary information for debugging purposes.longReturns the bytes which was transferred already.longReturns the bytes which was transferred already.longtransferTo(WritableByteChannel target, long position) Transfers the content of this file region to the specified channel.
-
Field Details
-
logger
-
SPLICE_TO_PIPE
private static final short SPLICE_TO_PIPE- See Also:
-
SPLICE_TO_SOCKET
private static final short SPLICE_TO_SOCKET- See Also:
-
fileRegion
-
pipe
-
transferred
private int transferred -
pipeLen
private int pipeLen
-
-
Constructor Details
-
IoUringFileRegion
IoUringFileRegion(DefaultFileRegion fileRegion)
-
-
Method Details
-
open
- Throws:
IOException
-
splice
-
spliceToPipe
IoUringIoOps spliceToPipe() -
spliceToSocket
-
handleResult
int handleResult(int result, short data) Handle splice result- Parameters:
result- the resultdata- 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:FileRegionReturns the offset in the file where the transfer began.- Specified by:
positionin interfaceFileRegion
-
transfered
public long transfered()Description copied from interface:FileRegionReturns the bytes which was transferred already.- Specified by:
transferedin interfaceFileRegion
-
transferred
public long transferred()Description copied from interface:FileRegionReturns the bytes which was transferred already.Note: some asynchronous transports (such as the
io_uringtransport when falling back to a chunked send for non-DefaultFileRegionimplementations) 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:
transferredin interfaceFileRegion
-
count
public long count()Description copied from interface:FileRegionReturns the number of bytes to transfer.- Specified by:
countin interfaceFileRegion
-
transferTo
Description copied from interface:FileRegionTransfers the content of this file region to the specified channel.- Specified by:
transferToin interfaceFileRegion- Parameters:
target- the destination of the transferposition- the relative offset of the file where the transfer begins from. For example, 0 will make the transfer start fromFileRegion.position()th byte andFileRegion.count()- 1 will make the last byte of the region transferred.
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by1.- Specified by:
retainin interfaceFileRegion- Specified by:
retainin interfaceReferenceCounted
-
retain
Description copied from interface:ReferenceCountedIncreases the reference count by the specifiedincrement.- Specified by:
retainin interfaceFileRegion- Specified by:
retainin interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords 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 viaResourceLeakDetector. This method is a shortcut totouch(null).- Specified by:
touchin interfaceFileRegion- Specified by:
touchin interfaceReferenceCounted
-
touch
Description copied from interface:ReferenceCountedRecords 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 viaResourceLeakDetector.- Specified by:
touchin interfaceFileRegion- Specified by:
touchin interfaceReferenceCounted
-
refCnt
public int refCnt()Description copied from interface:ReferenceCountedReturns the reference count of this object. If0, it means this object has been deallocated.- Specified by:
refCntin interfaceReferenceCounted
-
release
public boolean release()Description copied from interface:ReferenceCountedDecreases the reference count by1and deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
release
public boolean release(int decrement) Description copied from interface:ReferenceCountedDecreases the reference count by the specifieddecrementand deallocates this object if the reference count reaches at0.- Specified by:
releasein interfaceReferenceCounted- Returns:
trueif and only if the reference count became0and this object has been deallocated
-
closePipeIfNeeded
private void closePipeIfNeeded() -
closeSilently
-