GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Overview
  • Use
  • Tree
  • Deprecated
  • Index
  • Search
  • Help
  • io.netty.channel
  • DefaultFileRegion

This view

  • Original page
  • New address

GeezerVison is showing netty.io — DefaultFileRegion (Netty API Reference (4.1.141.Final))

Class DefaultFileRegion

java.lang.Object
io.netty.util.AbstractReferenceCounted
io.netty.channel.DefaultFileRegion
All Implemented Interfaces:
FileRegion, ReferenceCounted

public class DefaultFileRegion extends AbstractReferenceCounted implements FileRegion
Default FileRegion implementation which transfer data from a FileChannel or File. Be aware that the FileChannel will be automatically closed once AbstractReferenceCounted.refCnt() returns 0.
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultFileRegion(File file, long position, long count)
    Create a new instance using the given File.
    DefaultFileRegion(FileChannel fileChannel, long position, long count)
    Create a new instance
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    count()
    Returns the number of bytes to transfer.
    protected void
    deallocate()
    Called once AbstractReferenceCounted.refCnt() is equals 0.
    boolean
    isOpen()
    Returns true if the FileRegion has a open file-descriptor
    void
    open()
    Explicitly open the underlying file-descriptor if not done yet.
    long
    position()
    Returns the offset in the file where the transfer began.
    FileRegion
    retain()
    Increases the reference count by 1.
    FileRegion
    retain(int increment)
    Increases the reference count by the specified increment.
    FileRegion
    touch()
    Records the current access location of this object for debugging purposes.
    FileRegion
    touch(Object hint)
    Records the current access location of this object with an additional arbitrary information for debugging purposes.
    long
    transfered()
    Deprecated.
    long
    transferred()
    Returns the bytes which was transferred already.
    long
    transferTo(WritableByteChannel target, long position)
    Transfers the content of this file region to the specified channel.

    Methods inherited from class AbstractReferenceCounted

    refCnt, release, release, setRefCnt
    Modifier and Type
    Method
    Description
    int
    refCnt()
    Returns the reference count of this object.
    boolean
    release()
    Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
    boolean
    release(int decrement)
    Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
    protected final void
    setRefCnt(int refCnt)
    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

      public void open() throws IOException
      Explicitly open the underlying file-descriptor if not done yet.
      Throws:
      IOException
    • 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
    • count

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

      @Deprecated public long transfered()
      Deprecated.
      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.
      Specified by:
      transferred in interface FileRegion
    • transferTo

      public long transferTo(WritableByteChannel target, long position) throws IOException
      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.
      Throws:
      IOException
    • deallocate

      protected void deallocate()
      Description copied from class: AbstractReferenceCounted
      Called once AbstractReferenceCounted.refCnt() is equals 0.
      Specified by:
      deallocate in class AbstractReferenceCounted
    • 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
      Overrides:
      retain in class AbstractReferenceCounted
    • 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
      Overrides:
      retain in class AbstractReferenceCounted
    • 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
      Overrides:
      touch in class AbstractReferenceCounted
    • 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
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.