Package com.biglybt.core.download.impl
Class DownloadManagerController.fileInfoFacade
- java.lang.Object
-
- com.biglybt.core.download.impl.DownloadManagerController.fileInfoFacade
-
- All Implemented Interfaces:
DiskManagerFileInfo
- Enclosing class:
- DownloadManagerController
protected class DownloadManagerController.fileInfoFacade extends java.lang.Object implements DiskManagerFileInfo
-
-
Field Summary
Fields Modifier and Type Field Description private DiskManagerFileInfo
delegate
private java.util.List<DiskManagerFileInfoListener>
listeners
-
Fields inherited from interface com.biglybt.core.disk.DiskManagerFileInfo
READ, ST_COMPACT, ST_LINEAR, ST_REORDER, ST_REORDER_COMPACT, WRITE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
fileInfoFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DiskManagerFileInfoListener listener)
void
close()
boolean
exists()
Checks that the linked file exists (always returns true for pad files)void
flushCache()
int
getAccessMode()
DiskManager
getDiskManager()
long
getDownloaded()
DownloadManager
getDownloadManager()
long
getETA()
java.lang.String
getExtension()
java.io.File
getFile(boolean follow_link)
int
getFirstPieceNumber()
int
getIndex()
java.lang.String
getLastError()
long
getLastModified()
int
getLastPieceNumber()
long
getLength()
java.io.File
getLink()
int
getNbPieces()
int
getPriority()
File Download Priorityint
getReadBytesPerSecond()
int
getStorageType()
Returns the storage type for this fileTOTorrentFile
getTorrentFile()
int
getWriteBytesPerSecond()
boolean
isSkipped()
Skipped files don't get downloaded.DirectByteBuffer
read(long offset, int length)
void
recheck()
void
removeListener(DiskManagerFileInfoListener listener)
protected void
setDelegate(DiskManagerFileInfo new_delegate)
boolean
setLink(java.io.File link_destination)
Relink the file to the destination given - this method deals with if the file is part of a simple torrent or not (so it may set the download name to keep it in sync).boolean
setLinkAtomic(java.io.File link_destination)
boolean
setLinkAtomic(java.io.File link_destination, FileUtil.ProgressListener pl)
void
setPriority(int b)
void
setSkipped(boolean b)
boolean
setStorageType(int type, boolean force)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.core.disk.DiskManagerFileInfo
setStorageType
-
-
-
-
Field Detail
-
delegate
private volatile DiskManagerFileInfo delegate
-
listeners
private java.util.List<DiskManagerFileInfoListener> listeners
-
-
Method Detail
-
setDelegate
protected void setDelegate(DiskManagerFileInfo new_delegate)
-
setPriority
public void setPriority(int b)
- Specified by:
setPriority
in interfaceDiskManagerFileInfo
-
setSkipped
public void setSkipped(boolean b)
- Specified by:
setSkipped
in interfaceDiskManagerFileInfo
-
setLink
public boolean setLink(java.io.File link_destination)
Description copied from interface:DiskManagerFileInfo
Relink the file to the destination given - this method deals with if the file is part of a simple torrent or not (so it may set the download name to keep it in sync). If you just want a simple relink, use setLinkAtomic.- Specified by:
setLink
in interfaceDiskManagerFileInfo
- Returns:
- true - worked, false - failed, use getLastError to possibly get some extra info
-
getLastError
public java.lang.String getLastError()
- Specified by:
getLastError
in interfaceDiskManagerFileInfo
-
setLinkAtomic
public boolean setLinkAtomic(java.io.File link_destination)
- Specified by:
setLinkAtomic
in interfaceDiskManagerFileInfo
-
setLinkAtomic
public boolean setLinkAtomic(java.io.File link_destination, FileUtil.ProgressListener pl)
- Specified by:
setLinkAtomic
in interfaceDiskManagerFileInfo
-
getLink
public java.io.File getLink()
- Specified by:
getLink
in interfaceDiskManagerFileInfo
-
setStorageType
public boolean setStorageType(int type, boolean force)
- Specified by:
setStorageType
in interfaceDiskManagerFileInfo
force
- discards any existing file content if it exists - use with care...- Returns:
-
getStorageType
public int getStorageType()
Description copied from interface:DiskManagerFileInfo
Returns the storage type for this file- Specified by:
getStorageType
in interfaceDiskManagerFileInfo
- Returns:
DiskManagerFileInfo.ST_LINEAR
,DiskManagerFileInfo.ST_COMPACT
,DiskManagerFileInfo.ST_REORDER
,DiskManagerFileInfo.ST_REORDER_COMPACT
-
getAccessMode
public int getAccessMode()
- Specified by:
getAccessMode
in interfaceDiskManagerFileInfo
-
getDownloaded
public long getDownloaded()
- Specified by:
getDownloaded
in interfaceDiskManagerFileInfo
-
getLastModified
public long getLastModified()
- Specified by:
getLastModified
in interfaceDiskManagerFileInfo
-
getExtension
public java.lang.String getExtension()
- Specified by:
getExtension
in interfaceDiskManagerFileInfo
-
getFirstPieceNumber
public int getFirstPieceNumber()
- Specified by:
getFirstPieceNumber
in interfaceDiskManagerFileInfo
-
getLastPieceNumber
public int getLastPieceNumber()
- Specified by:
getLastPieceNumber
in interfaceDiskManagerFileInfo
-
getLength
public long getLength()
- Specified by:
getLength
in interfaceDiskManagerFileInfo
-
getNbPieces
public int getNbPieces()
- Specified by:
getNbPieces
in interfaceDiskManagerFileInfo
-
getPriority
public int getPriority()
Description copied from interface:DiskManagerFileInfo
File Download Priority- Specified by:
getPriority
in interfaceDiskManagerFileInfo
- Returns:
- Common:
-1
: Low
0
: Normal
1
: High
Not Common:
<-1
: Lower and Lower
>0
: Higher and Higher
-
isSkipped
public boolean isSkipped()
Description copied from interface:DiskManagerFileInfo
Skipped files don't get downloaded. The state of the existing data is dependent uponDiskManagerFileInfo.getStorageType()
. StatesDiskManagerFileInfo.ST_COMPACT
andDiskManagerFileInfo.ST_REORDER_COMPACT
will delete (or trim) the file. Other states will retain existing data (ie. Do Not Download).- Specified by:
isSkipped
in interfaceDiskManagerFileInfo
-
exists
public boolean exists()
Description copied from interface:DiskManagerFileInfo
Checks that the linked file exists (always returns true for pad files)- Specified by:
exists
in interfaceDiskManagerFileInfo
- Returns:
-
getIndex
public int getIndex()
- Specified by:
getIndex
in interfaceDiskManagerFileInfo
-
getDiskManager
public DiskManager getDiskManager()
- Specified by:
getDiskManager
in interfaceDiskManagerFileInfo
-
getDownloadManager
public DownloadManager getDownloadManager()
- Specified by:
getDownloadManager
in interfaceDiskManagerFileInfo
-
getFile
public java.io.File getFile(boolean follow_link)
- Specified by:
getFile
in interfaceDiskManagerFileInfo
-
getTorrentFile
public TOTorrentFile getTorrentFile()
- Specified by:
getTorrentFile
in interfaceDiskManagerFileInfo
-
flushCache
public void flushCache() throws java.lang.Exception
- Specified by:
flushCache
in interfaceDiskManagerFileInfo
- Throws:
java.lang.Exception
-
read
public DirectByteBuffer read(long offset, int length) throws java.io.IOException
- Specified by:
read
in interfaceDiskManagerFileInfo
- Throws:
java.io.IOException
-
getReadBytesPerSecond
public int getReadBytesPerSecond()
- Specified by:
getReadBytesPerSecond
in interfaceDiskManagerFileInfo
-
getWriteBytesPerSecond
public int getWriteBytesPerSecond()
- Specified by:
getWriteBytesPerSecond
in interfaceDiskManagerFileInfo
-
getETA
public long getETA()
- Specified by:
getETA
in interfaceDiskManagerFileInfo
-
recheck
public void recheck()
- Specified by:
recheck
in interfaceDiskManagerFileInfo
-
close
public void close()
- Specified by:
close
in interfaceDiskManagerFileInfo
-
addListener
public void addListener(DiskManagerFileInfoListener listener)
- Specified by:
addListener
in interfaceDiskManagerFileInfo
-
removeListener
public void removeListener(DiskManagerFileInfoListener listener)
- Specified by:
removeListener
in interfaceDiskManagerFileInfo
-
-