GeezerVison is showing netty.io — DefaultFileRegion (Netty API Reference (4.1.141.Final))
Class DefaultFileRegion
-
Constructor Summary
Constructors
Constructor
Description
Create a new instance using the given File.
-
Method Summary
Modifier and Type
Method
Description
long
Returns the number of bytes to transfer.
protected void
boolean
Returns true if the FileRegion has a open file-descriptor
void
Explicitly open the underlying file-descriptor if not done yet.
long
Returns the offset in the file where the transfer began.
Increases the reference count by 1.
Increases the reference count by the specified increment.
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.
long
long
Returns the bytes which was transferred already.
long
Transfers the content of this file region to the specified channel.
refCnt, release, release, setRefCnt
Modifier and Type
Method
Description
int
Returns the reference count of this object.
boolean
Decreases the reference count by 1 and deallocates this object if the reference count reaches at
0.
boolean
Decreases the reference count by the specified decrement and deallocates this object if the reference
count reaches at 0.
protected final void
An unsafe operation intended for use by a subclass that sets the reference count of the buffer directly
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DefaultFileRegion
public DefaultFileRegion(FileChannel fileChannel,
long position,
long count)
Create a new instance
- Parameters:
fileChannel - the FileChannel which should be transferred
position - the position from which the transfer should start
count - the number of bytes to transfer
-
DefaultFileRegion
public DefaultFileRegion(File file,
long position,
long count)
Create a new instance using the given File. The File will be opened lazily or
explicitly via open().
- Parameters:
file - the File which should be transferred
position - the position from which the transfer should start
count - the number of bytes to transfer
-
Method Details
-
isOpen
public boolean isOpen()
Returns true if the FileRegion has a open file-descriptor
-
open
Explicitly open the underlying file-descriptor if not done yet.
- Throws:
IOException
-
position
public long position()
Returns the offset in the file where the transfer began.
- Specified by:
position in interface FileRegion
-
count
public long count()
Returns the number of bytes to transfer.
- Specified by:
count in interface FileRegion
-
transfered
Deprecated.
Returns the bytes which was transferred already.
- Specified by:
transfered in interface FileRegion
-
transferred
public long transferred()
Returns the bytes which was transferred already.
- Specified by:
transferred in interface FileRegion
-
transferTo
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.
- Throws:
IOException
-
-
-
-
-
touch
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
|