Package com.biglybt.core.download
Class DiskManagerFileInfoURL
- java.lang.Object
-
- com.biglybt.core.download.DiskManagerFileInfoURL
-
- All Implemented Interfaces:
SEPasswordListener
,DiskManagerFileInfo
public class DiskManagerFileInfoURL extends java.lang.Object implements DiskManagerFileInfo, SEPasswordListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DiskManagerFileInfoURL.channel
-
Field Summary
Fields Modifier and Type Field Description (package private) int
consec_redirect_fails
(package private) java.io.File
file
private boolean
file_cached
private byte[]
hash
private java.lang.Object
lock
(package private) java.net.URL
redirected_url
(package private) java.net.URL
url
-
Fields inherited from interface com.biglybt.pif.disk.DiskManagerFileInfo
PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL, READ, WRITE
-
-
Constructor Summary
Constructors Constructor Description DiskManagerFileInfoURL(java.net.URL _url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearPasswords()
DiskManagerFileInfoURL.channel
createChannel()
DiskManagerRandomReadRequest
createRandomReadRequest(long file_offset, long length, boolean reverse_order, DiskManagerListener listener)
Creates a random read request - these will be executed against the download sequentiallyvoid
download()
int
getAccessMode()
java.net.PasswordAuthentication
getAuthentication(java.lang.String realm, java.net.URL tracker)
Download
getDownload()
long
getDownloaded()
byte[]
getDownloadHash()
java.io.File
getFile()
java.io.File
getFile(boolean follow_link)
returns liked file if it exists, direct otherwiseint
getFirstPieceNumber()
int
getIndex()
long
getLastModified()
long
getLength()
Size when file is completejava.io.File
getLink()
int
getNumericPriority()
int
getNumPieces()
long
getPieceSize()
java.net.URL
getURL()
boolean
isDeleted()
boolean
isPriority()
boolean
isSkipped()
void
setAuthenticationOutcome(java.lang.String realm, java.net.URL tracker, boolean success)
void
setDeleted(boolean b)
Mark the file as deleted or not (deleted means the file will be truncated to take up minimum space).void
setLink(java.io.File link_destination)
void
setNumericPriority(int priority)
Sets the file's download priority base on a numbervoid
setPriority(boolean b)
void
setSkipped(boolean b)
-
-
-
Method Detail
-
getURL
public java.net.URL getURL()
-
download
public void download()
-
setPriority
public void setPriority(boolean b)
- Specified by:
setPriority
in interfaceDiskManagerFileInfo
-
setSkipped
public void setSkipped(boolean b)
- Specified by:
setSkipped
in interfaceDiskManagerFileInfo
-
getNumericPriority
public int getNumericPriority()
- Specified by:
getNumericPriority
in interfaceDiskManagerFileInfo
- Returns:
-
setNumericPriority
public void setNumericPriority(int priority)
Description copied from interface:DiskManagerFileInfo
Sets the file's download priority base on a number- Specified by:
setNumericPriority
in interfaceDiskManagerFileInfo
- Parameters:
priority
- Any number orDiskManagerFileInfo.PRIORITY_LOW
,DiskManagerFileInfo.PRIORITY_NORMAL
,DiskManagerFileInfo.PRIORITY_HIGH
-
setDeleted
public void setDeleted(boolean b)
Description copied from interface:DiskManagerFileInfo
Mark the file as deleted or not (deleted means the file will be truncated to take up minimum space). This is generally 0 <= X < 2*piece_length as pieces can span file boundaries.- Specified by:
setDeleted
in interfaceDiskManagerFileInfo
-
setLink
public void setLink(java.io.File link_destination)
- Specified by:
setLink
in interfaceDiskManagerFileInfo
-
getLink
public java.io.File getLink()
- Specified by:
getLink
in interfaceDiskManagerFileInfo
-
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
-
getLength
public long getLength()
Description copied from interface:DiskManagerFileInfo
Size when file is complete- Specified by:
getLength
in interfaceDiskManagerFileInfo
-
getFile
public java.io.File getFile()
- Specified by:
getFile
in interfaceDiskManagerFileInfo
-
getFile
public java.io.File getFile(boolean follow_link)
Description copied from interface:DiskManagerFileInfo
returns liked file if it exists, direct otherwise- Specified by:
getFile
in interfaceDiskManagerFileInfo
- Returns:
-
getIndex
public int getIndex()
- Specified by:
getIndex
in interfaceDiskManagerFileInfo
-
getFirstPieceNumber
public int getFirstPieceNumber()
- Specified by:
getFirstPieceNumber
in interfaceDiskManagerFileInfo
-
getPieceSize
public long getPieceSize()
- Specified by:
getPieceSize
in interfaceDiskManagerFileInfo
-
getNumPieces
public int getNumPieces()
- Specified by:
getNumPieces
in interfaceDiskManagerFileInfo
-
isPriority
public boolean isPriority()
- Specified by:
isPriority
in interfaceDiskManagerFileInfo
-
isSkipped
public boolean isSkipped()
- Specified by:
isSkipped
in interfaceDiskManagerFileInfo
-
isDeleted
public boolean isDeleted()
- Specified by:
isDeleted
in interfaceDiskManagerFileInfo
-
getDownloadHash
public byte[] getDownloadHash() throws DownloadException
- Specified by:
getDownloadHash
in interfaceDiskManagerFileInfo
- Throws:
DownloadException
-
getDownload
public Download getDownload() throws DownloadException
- Specified by:
getDownload
in interfaceDiskManagerFileInfo
- Throws:
DownloadException
-
createChannel
public DiskManagerFileInfoURL.channel createChannel() throws DownloadException
- Specified by:
createChannel
in interfaceDiskManagerFileInfo
- Throws:
DownloadException
-
createRandomReadRequest
public DiskManagerRandomReadRequest createRandomReadRequest(long file_offset, long length, boolean reverse_order, DiskManagerListener listener) throws DownloadException
Description copied from interface:DiskManagerFileInfo
Creates a random read request - these will be executed against the download sequentially- Specified by:
createRandomReadRequest
in interfaceDiskManagerFileInfo
reverse_order
- - deliver blocks to the listener in reverse order- Returns:
- Throws:
DownloadException
-
getAuthentication
public java.net.PasswordAuthentication getAuthentication(java.lang.String realm, java.net.URL tracker)
- Specified by:
getAuthentication
in interfaceSEPasswordListener
-
setAuthenticationOutcome
public void setAuthenticationOutcome(java.lang.String realm, java.net.URL tracker, boolean success)
- Specified by:
setAuthenticationOutcome
in interfaceSEPasswordListener
-
clearPasswords
public void clearPasswords()
- Specified by:
clearPasswords
in interfaceSEPasswordListener
-
-