|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gudy.azureus2.core3.util.TorrentUtils
public class TorrentUtils
Nested Class Summary | |
---|---|
static interface |
TorrentUtils.ExtendedTorrent
|
static interface |
TorrentUtils.TorrentAnnounceURLChangeListener
|
static interface |
TorrentUtils.torrentAttributeListener
|
static class |
TorrentUtils.torrentDelegate
|
Field Summary | |
---|---|
static long |
MAX_TORRENT_FILE_SIZE
|
static String |
TORRENT_AZ_PROP_INITIAL_LINKAGE
|
static String |
TORRENT_AZ_PROP_INITIAL_LINKAGE2
|
static String |
TORRENT_AZ_PROP_OBTAINED_FROM
|
static int |
TORRENT_FLAG_LOW_NOISE
|
static int |
TORRENT_FLAG_METADATA_TORRENT
|
Constructor Summary | |
---|---|
TorrentUtils()
|
Method Summary | |
---|---|
static void |
addCreatedTorrent(TOTorrent torrent)
|
static void |
addTorrentAttributeListener(TorrentUtils.torrentAttributeListener listener)
|
static void |
addTorrentURLChangeListener(TorrentUtils.TorrentAnnounceURLChangeListener listener)
|
static boolean |
announceGroupsContainsURL(TOTorrent torrent,
String url)
|
static void |
announceGroupsInsertFirst(TOTorrent torrent,
String first_url)
|
static void |
announceGroupsInsertFirst(TOTorrent torrent,
URL first_url)
|
static void |
announceGroupsInsertFirst(TOTorrent torrent,
URL[] first_urls)
|
static void |
announceGroupsInsertLast(TOTorrent torrent,
URL[] first_urls)
|
static void |
announceGroupsSetFirst(TOTorrent torrent,
String first_url)
|
static List<List<String>> |
announceGroupsToList(TOTorrent torrent)
|
static String |
announceGroupsToText(List<List<String>> group)
|
static String |
announceGroupsToText(TOTorrent torrent)
|
static List<List<String>> |
announceTextToGroups(String text)
|
static boolean |
canMergeAnnounceURLs(TOTorrent new_torrent,
TOTorrent dest_torrent)
|
static TOTorrent |
cloneTorrent(TOTorrent torrent)
|
static void |
copyToFile(TOTorrent torrent,
File file)
|
static File |
copyTorrentFileToSaveDir(File f,
boolean persistent)
Copy a file to the Torrent Save Directory, taking into account all the user config options related to that. |
static void |
delete(File torrent_file,
boolean force_no_recycle)
|
static void |
delete(TOTorrent torrent)
|
static TOTorrent |
download(URL url)
|
static TOTorrent |
download(URL url,
long timeout)
|
static void |
endTorrentDelete()
|
static String |
exceptionToText(TOTorrentException e)
|
static List<List<String>> |
getClone(List<List<String>> lls)
|
static URL |
getDecentralisedEmptyURL()
|
static URL |
getDecentralisedURL(byte[] hash)
|
static URL |
getDecentralisedURL(TOTorrent torrent)
|
static boolean |
getDHTBackupEnabled(TOTorrent torrent)
|
static DownloadManager |
getDownloadManager(HashWrapper hash)
Get the DownloadManager related to a torrent's hashBytes |
static boolean |
getFlag(TOTorrent torrent,
int flag)
|
static Set<String> |
getIgnoreSet()
|
static Map<Integer,File> |
getInitialLinkage(TOTorrent torrent)
|
static String |
getLocalisedName(TOTorrent torrent)
|
static long |
getMillisecondsSinceLastTorrentDelete()
|
static List<String> |
getNetworkCache(TOTorrent torrent)
|
static String |
getObtainedFrom(TOTorrent torrent)
|
static Map |
getPeerCache(TOTorrent torrent)
|
static Map |
getPluginMapProperty(TOTorrent torrent,
String name)
|
static String |
getPluginStringProperty(TOTorrent torrent,
String name)
|
static boolean |
getPrivate(TOTorrent torrent)
|
static Set<String> |
getSkipExtensionsSet()
|
static List<String> |
getTagCache(TOTorrent torrent)
|
static Object |
getTLS()
get tls for cloning onto another thread |
static String |
getTLSDescription()
|
static TOTorrent |
getTLSTorrent()
|
static HashWrapper |
getTLSTorrentHash()
|
static String |
getTorrentFileName(TOTorrent torrent)
|
static Set<String> |
getUniqueTrackerHosts(TOTorrent torrent)
|
static boolean |
isCreatedTorrent(TOTorrent torrent)
|
static boolean |
isDecentralised(String host)
|
static boolean |
isDecentralised(TOTorrent torrent)
|
static boolean |
isDecentralised(URL url)
|
static boolean |
isDHTBackupRequested(TOTorrent torrent)
|
static boolean |
isFeaturedContent(TOTorrent torrent)
|
static boolean |
isReallyPrivate(TOTorrent torrent)
|
static boolean |
isTorrentDeleting()
|
static boolean |
isTorrentFile(String filename)
Runs a file through a series of test to verify if it is a torrent. |
static void |
listToAnnounceGroups(List<List<String>> groups,
TOTorrent torrent)
|
static TOTorrentAnnounceURLSet[] |
listToAnnounceSets(List<List<String>> groups,
TOTorrent torrent)
This method DOES NOT MODIFY THE TORRENT |
static void |
main(String[] args)
|
static List<List<String>> |
mergeAnnounceURLs(List<List<String>> base_urls,
List<List<String>> merge_urls)
|
static boolean |
mergeAnnounceURLs(TOTorrent new_torrent,
TOTorrent dest_torrent)
|
static boolean |
move(File from_torrent,
File to_torrent)
|
static String |
nicePrintTorrentHash(TOTorrent torrent)
A nice string of a Torrent's hash |
static String |
nicePrintTorrentHash(TOTorrent torrent,
boolean tight)
A nice string of a Torrent's hash |
static TorrentUtils.ExtendedTorrent |
readDelegateFromFile(File file,
boolean force_initial_discard)
If you set "create_delegate" to true then you must understand that this results is piece hashes being discarded and then re-read from the torrent file if needed Therefore, if you delete the original torrent file you're going to get errors if you access the pieces after this (and they've been discarded) |
static TOTorrent |
readFromBEncodedInputStream(InputStream is)
|
static TOTorrent |
readFromFile(File file,
boolean create_delegate)
|
static TOTorrent |
readFromFile(File file,
boolean create_delegate,
boolean force_initial_discard)
|
static void |
recursiveEmptyDirDelete(File f)
Deletes the given dir and all dirs underneath if empty. |
static void |
recursiveEmptyDirDelete(File f,
boolean log_warnings)
Same as #recursiveEmptyDirDelete(File), except allows disabling of logging of any warnings |
static void |
registerMapFluff(String[] fluff)
Register keys that are used for heavyweight maps that should be discarded when the torrent is not in use Make sure these keys are only ever used for Map objects! |
static List<List<String>> |
removeAnnounceURLs(List<List<String>> base_urls,
List<List<String>> remove_urls,
boolean use_prefix_match)
|
static List<List<String>> |
removeAnnounceURLs2(List<List<String>> base_urls,
List<String> remove_urls,
boolean use_prefix_match)
|
static void |
removeCreatedTorrent(TOTorrent torrent)
|
static void |
removeTorrentAttributeListener(TorrentUtils.torrentAttributeListener listener)
|
static void |
removeTorrentURLChangeListener(TorrentUtils.TorrentAnnounceURLChangeListener listener)
|
static boolean |
replaceAnnounceURL(TOTorrent torrent,
URL old_url,
URL new_url)
|
static void |
runTorrentDelete(Runnable target)
|
static void |
setDecentralised(TOTorrent torrent)
|
static void |
setDHTBackupEnabled(TOTorrent torrent,
boolean enabled)
|
static void |
setDHTBackupRequested(TOTorrent torrent,
boolean requested)
|
static void |
setFlag(TOTorrent torrent,
int flag,
boolean value)
|
static void |
setMemoryOnly(TOTorrent torrent,
boolean mem_only)
|
static void |
setNetworkCache(TOTorrent torrent,
List<String> networks)
|
static void |
setObtainedFrom(File file,
String str)
|
static void |
setObtainedFrom(TOTorrent torrent,
String str)
|
static void |
setPeerCache(TOTorrent torrent,
Map pc)
|
static void |
setPeerCacheValid(TOTorrent torrent)
|
static void |
setPluginMapProperty(TOTorrent torrent,
String name,
Map value)
|
static void |
setPluginStringProperty(TOTorrent torrent,
String name,
String value)
|
static void |
setPrivate(TOTorrent torrent,
boolean _private)
|
static void |
setResumeDataCompletelyValid(DownloadManagerState download_manager_state)
|
static void |
setTagCache(TOTorrent torrent,
List<String> networks)
|
static void |
setTLS(Object obj)
|
static void |
setTLSDescription(String desc)
|
static void |
setTLSTorrentHash(HashWrapper hash)
|
static void |
setTorrentDeleted()
|
static boolean |
shouldDeleteTorrentFileAfterAdd(File f,
boolean persistent)
|
static void |
startTorrentDelete()
|
static void |
writeToFile(TOTorrent torrent)
|
static void |
writeToFile(TOTorrent torrent,
boolean force_backup)
|
static void |
writeToFile(TOTorrent torrent,
File file)
|
static void |
writeToFile(TOTorrent torrent,
File file,
boolean force_backup)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long MAX_TORRENT_FILE_SIZE
public static final int TORRENT_FLAG_LOW_NOISE
public static final int TORRENT_FLAG_METADATA_TORRENT
public static final String TORRENT_AZ_PROP_OBTAINED_FROM
public static final String TORRENT_AZ_PROP_INITIAL_LINKAGE
public static final String TORRENT_AZ_PROP_INITIAL_LINKAGE2
Constructor Detail |
---|
public TorrentUtils()
Method Detail |
---|
public static TOTorrent readFromFile(File file, boolean create_delegate) throws TOTorrentException
TOTorrentException
public static TorrentUtils.ExtendedTorrent readDelegateFromFile(File file, boolean force_initial_discard) throws TOTorrentException
file
- create_delegate
- force_initial_discard
- - use to get rid of pieces immediately
TOTorrentException
public static TOTorrent readFromFile(File file, boolean create_delegate, boolean force_initial_discard) throws TOTorrentException
TOTorrentException
public static TOTorrent readFromBEncodedInputStream(InputStream is) throws TOTorrentException
TOTorrentException
public static TOTorrent cloneTorrent(TOTorrent torrent) throws TOTorrentException
TOTorrentException
public static void setMemoryOnly(TOTorrent torrent, boolean mem_only)
public static void writeToFile(TOTorrent torrent) throws TOTorrentException
TOTorrentException
public static void writeToFile(TOTorrent torrent, boolean force_backup) throws TOTorrentException
TOTorrentException
public static void writeToFile(TOTorrent torrent, File file) throws TOTorrentException
TOTorrentException
public static void writeToFile(TOTorrent torrent, File file, boolean force_backup) throws TOTorrentException
TOTorrentException
public static String getTorrentFileName(TOTorrent torrent) throws TOTorrentException
TOTorrentException
public static void copyToFile(TOTorrent torrent, File file) throws TOTorrentException
TOTorrentException
public static void delete(TOTorrent torrent) throws TOTorrentException
TOTorrentException
public static void delete(File torrent_file, boolean force_no_recycle)
public static boolean move(File from_torrent, File to_torrent)
public static String exceptionToText(TOTorrentException e)
public static Set<String> getUniqueTrackerHosts(TOTorrent torrent)
public static String announceGroupsToText(TOTorrent torrent)
public static String announceGroupsToText(List<List<String>> group)
public static List<List<String>> announceTextToGroups(String text)
public static List<List<String>> announceGroupsToList(TOTorrent torrent)
public static TOTorrentAnnounceURLSet[] listToAnnounceSets(List<List<String>> groups, TOTorrent torrent)
groups
- torrent
-
public static void listToAnnounceGroups(List<List<String>> groups, TOTorrent torrent)
public static void announceGroupsInsertFirst(TOTorrent torrent, String first_url)
public static void announceGroupsInsertFirst(TOTorrent torrent, URL first_url)
public static void announceGroupsInsertFirst(TOTorrent torrent, URL[] first_urls)
public static void announceGroupsInsertLast(TOTorrent torrent, URL[] first_urls)
public static void announceGroupsSetFirst(TOTorrent torrent, String first_url)
public static boolean announceGroupsContainsURL(TOTorrent torrent, String url)
public static boolean canMergeAnnounceURLs(TOTorrent new_torrent, TOTorrent dest_torrent)
public static boolean mergeAnnounceURLs(TOTorrent new_torrent, TOTorrent dest_torrent)
public static List<List<String>> mergeAnnounceURLs(List<List<String>> base_urls, List<List<String>> merge_urls)
public static List<List<String>> removeAnnounceURLs(List<List<String>> base_urls, List<List<String>> remove_urls, boolean use_prefix_match)
public static List<List<String>> removeAnnounceURLs2(List<List<String>> base_urls, List<String> remove_urls, boolean use_prefix_match)
public static List<List<String>> getClone(List<List<String>> lls)
public static boolean replaceAnnounceURL(TOTorrent torrent, URL old_url, URL new_url)
public static void setResumeDataCompletelyValid(DownloadManagerState download_manager_state)
public static String getLocalisedName(TOTorrent torrent)
public static void setTLSTorrentHash(HashWrapper hash)
public static HashWrapper getTLSTorrentHash()
public static TOTorrent getTLSTorrent()
public static void setTLSDescription(String desc)
public static String getTLSDescription()
public static Object getTLS()
public static void setTLS(Object obj)
public static URL getDecentralisedEmptyURL()
public static URL getDecentralisedURL(byte[] hash)
public static URL getDecentralisedURL(TOTorrent torrent)
public static void setDecentralised(TOTorrent torrent)
public static boolean isDecentralised(TOTorrent torrent)
public static boolean isDecentralised(URL url)
public static boolean isDecentralised(String host)
public static boolean isFeaturedContent(TOTorrent torrent)
public static void setObtainedFrom(File file, String str)
public static void setObtainedFrom(TOTorrent torrent, String str)
public static String getObtainedFrom(TOTorrent torrent)
public static void setNetworkCache(TOTorrent torrent, List<String> networks)
public static List<String> getNetworkCache(TOTorrent torrent)
public static void setTagCache(TOTorrent torrent, List<String> networks)
public static List<String> getTagCache(TOTorrent torrent)
public static void setPeerCache(TOTorrent torrent, Map pc)
public static void setPeerCacheValid(TOTorrent torrent)
public static Map getPeerCache(TOTorrent torrent)
public static void setFlag(TOTorrent torrent, int flag, boolean value)
public static boolean getFlag(TOTorrent torrent, int flag)
public static Map<Integer,File> getInitialLinkage(TOTorrent torrent)
public static void setPluginStringProperty(TOTorrent torrent, String name, String value)
public static String getPluginStringProperty(TOTorrent torrent, String name)
public static void setPluginMapProperty(TOTorrent torrent, String name, Map value)
public static Map getPluginMapProperty(TOTorrent torrent, String name)
public static void setDHTBackupEnabled(TOTorrent torrent, boolean enabled)
public static boolean getDHTBackupEnabled(TOTorrent torrent)
public static boolean isDHTBackupRequested(TOTorrent torrent)
public static void setDHTBackupRequested(TOTorrent torrent, boolean requested)
public static boolean isReallyPrivate(TOTorrent torrent)
public static boolean getPrivate(TOTorrent torrent)
public static void setPrivate(TOTorrent torrent, boolean _private)
public static Set<String> getSkipExtensionsSet()
public static Set<String> getIgnoreSet()
public static void registerMapFluff(String[] fluff)
public static File copyTorrentFileToSaveDir(File f, boolean persistent) throws IOException
Also makes the directory if it doesn't exist.
f
- File to copypersistent
- Whether the torrent is persistent
IOException
public static boolean shouldDeleteTorrentFileAfterAdd(File f, boolean persistent)
public static DownloadManager getDownloadManager(HashWrapper hash)
hashBytes
-
public static void recursiveEmptyDirDelete(File f)
public static void recursiveEmptyDirDelete(File f, boolean log_warnings)
f
- Dir to deletelog_warnings
- Whether to log warningpublic static String nicePrintTorrentHash(TOTorrent torrent)
torrent
- Torrent to fromat hash of
public static String nicePrintTorrentHash(TOTorrent torrent, boolean tight)
torrent
- Torrent to fromat hash oftight
- No spaces between groups of numbers
public static boolean isTorrentFile(String filename) throws FileNotFoundException, IOException
filename
- File to test
FileNotFoundException
IOException
public static void addCreatedTorrent(TOTorrent torrent)
public static void removeCreatedTorrent(TOTorrent torrent)
public static boolean isCreatedTorrent(TOTorrent torrent)
public static TOTorrent download(URL url) throws IOException
IOException
public static TOTorrent download(URL url, long timeout) throws IOException
IOException
public static void addTorrentAttributeListener(TorrentUtils.torrentAttributeListener listener)
public static void removeTorrentAttributeListener(TorrentUtils.torrentAttributeListener listener)
public static void addTorrentURLChangeListener(TorrentUtils.TorrentAnnounceURLChangeListener listener)
public static void removeTorrentURLChangeListener(TorrentUtils.TorrentAnnounceURLChangeListener listener)
public static void startTorrentDelete()
public static void endTorrentDelete()
public static void runTorrentDelete(Runnable target)
public static boolean isTorrentDeleting()
public static void setTorrentDeleted()
public static long getMillisecondsSinceLastTorrentDelete()
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |