Interface Utilities
- All Known Implementing Classes:
UtilitiesImpl
public interface Utilities
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocationProvider(LocationProvider provider) voidvoidvoidallocateDirectByteBuffer(int size) allocatePooledByteBuffer(byte[] data) allocatePooledByteBuffer(int size) allocatePooledByteBuffer(Map data) intcompareVersions(String v1, String v2) Compares two version strings for order.createAggregatedDispatcher(long idle_dispatch_time, long max_queue_size) create a dispatcher that will queue runnable items until either the limit is reached or the dispatcher hasn't had an entry added for the defined idle timecreateAggregatedList(AggregatedListAcceptor acceptor, long idle_dispatch_time, long max_queue_size) Adds a low priority task that will be scheduled at some point after existing tasks have completed.voidcreateProcess(File working_dirctory, String[] command, String[] env) voidcreateProcess(String command_line) create a child process and executes the supplied command line.voidcreateThread(String name, Runnable target) create and run a thread for the target.createTimer(String name) Creates aUTTimerinstance.createTimer(String name, boolean lightweight) Creates aUTTimerinstance.createTimer(String name, int priority) Creates aUTTimerinstance.createTimer(String name, int max_threads, int priority) createWrapper(byte[] data) voiddeleteResilientBEncodedFile(File parent_dir, String file_name, boolean use_backup) voidfreeDirectByteBuffer(ByteBuffer buffer) longGet the current system time, like System.currentTimeMillis(), only the time lookup is cached for performance reasons.getDistributedDatabases(String[] networks) getDistributedDatabases(String[] networks, Map<String, Object> options) getImageAsStream(String image_name) Returns a public IP address of the machine or null if it can't be determinedgetPublicAddress(boolean ipv6) getRSSFeed(URL feed_location) getRSSFeed(URL source_url, ResourceDownloader feed_location) getRSSFeed(URL source_url, InputStream is) booleanbooleanbooleanisLinux()booleanisOSX()booleanbooleanisUnix()booleannormaliseFileName(String f_name) Converts a file name so that all characters in the file name are compatible with the underlying filesystem.readResilientBEncodedFile(File parent_dir, String file_name, boolean use_backup) voidvoidvoidregisterScriptProvider(ScriptProvider provider) voidregisterSearchProvider(SearchProvider provider) voidremoveLocationProvider(LocationProvider provider) voidvoidvoidreverseDNSLookup(InetAddress address) attempts a reverse DNS lookup of an address, null if it failsbooleansupportsPowerStateControl(int state) voidvoidvoidunregisterScriptProvider(ScriptProvider provider) voidunregisterSearchProvider(SearchProvider provider) voidwriteResilientBEncodedFile(File parent_dir, String file_name, Map data, boolean use_backup)
-
Method Details
-
getUserDir
String getUserDir() -
getProgramDir
String getProgramDir() -
isCVSVersion
boolean isCVSVersion() -
isWindows
boolean isWindows() -
isLinux
boolean isLinux() -
isSolaris
boolean isSolaris() -
isOSX
boolean isOSX() -
isUnix
boolean isUnix()- Returns:
- Whether the OS is a unix flavor (linux, bsd, aix, etc)
- Since:
- 2.4.0.3
-
isFreeBSD
boolean isFreeBSD()- Returns:
- Whether the OS is FreeBSD
- Since:
- 2.4.0.3
-
getImageAsStream
-
getSemaphore
Semaphore getSemaphore() -
getMonitor
Monitor getMonitor() -
allocateDirectByteBuffer
-
freeDirectByteBuffer
-
allocatePooledByteBuffer
-
allocatePooledByteBuffer
-
allocatePooledByteBuffer
- Parameters:
data- must be b-encodable- Returns:
- Throws:
IOException
-
getFormatters
Formatters getFormatters() -
getLocaleUtilities
LocaleUtilities getLocaleUtilities() -
createTimer
-
createTimer
Creates aUTTimerinstance.- Parameters:
name- Name for the UTTimer object.lightweight- Iftrue, it indicates that this timer will be used to perform small lightweight tasks. Iffalse, it indicates that this timer will be used to perform expensive tasks. This allows Azureus to create the appropriate amount of resources to manage this timer.- Returns:
- A UTTimer instance.
-
createTimer
-
createTimer
-
createThread
-
createProcess
create a child process and executes the supplied command line. The child process will not inherit any open handles on Windows, which does happen if Runtime is used directly. This relies on the Platform plugin, if this is not installed then this will fall back to using Runtime.exec- Parameters:
command_line-- Throws:
PluginException
-
createProcess
- Throws:
PluginException
-
getResourceDownloaderFactory
ResourceDownloaderFactory getResourceDownloaderFactory() -
getResourceUploaderFactory
ResourceUploaderFactory getResourceUploaderFactory() -
getSecurityManager
SESecurityManager getSecurityManager() -
getSimpleXMLParserDocumentFactory
SimpleXMLParserDocumentFactory getSimpleXMLParserDocumentFactory() -
getRSSFeed
- Throws:
SimpleXMLParserDocumentException
-
getRSSFeed
RSSFeed getRSSFeed(URL feed_location) throws ResourceDownloaderException, SimpleXMLParserDocumentException -
getRSSFeed
RSSFeed getRSSFeed(URL source_url, ResourceDownloader feed_location) throws ResourceDownloaderException, SimpleXMLParserDocumentException -
getPublicAddress
InetAddress getPublicAddress()Returns a public IP address of the machine or null if it can't be determined -
getPublicAddress
-
reverseDNSLookup
attempts a reverse DNS lookup of an address, null if it fails- Parameters:
address-- Returns:
-
getCurrentSystemTime
long getCurrentSystemTime()Get the current system time, like System.currentTimeMillis(), only the time lookup is cached for performance reasons.- Returns:
- current system time
-
createWrapper
-
createAggregatedDispatcher
create a dispatcher that will queue runnable items until either the limit is reached or the dispatcher hasn't had an entry added for the defined idle time- Parameters:
idle_dispatch_time- millisecondsmax_queue_size- 0 -> infinite- Returns:
-
createAggregatedList
AggregatedList createAggregatedList(AggregatedListAcceptor acceptor, long idle_dispatch_time, long max_queue_size) -
readResilientBEncodedFile
-
writeResilientBEncodedFile
-
deleteResilientBEncodedFile
-
compareVersions
Compares two version strings for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.Example:
compareVersions("1.1.0.0", "1.1.2.0"); // - compareVersions("1.1.0.0", "1.1.0"); // 0 compareVersions("1.1.1.1", "1.1.1"); // +- Parameters:
v1- the first version string to be comparedv2- the second version string to be compared- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
- Since:
- 2.3.0.7
-
normaliseFileName
Converts a file name so that all characters in the file name are compatible with the underlying filesystem. This includes quote characters, back and forwarded slashes, newline characters and so on.Note - this is only intended for file names, rather than file paths.
- Parameters:
f_name- File name to convert.- Returns:
- Converted file name.
-
createDelayedTask
Adds a low priority task that will be scheduled at some point after existing tasks have completed. In particular a system task exists that will block subsequent ones until after UI initialisation is complete. Plugins can therefore use this to schedule initialisation actions to occur after UI init is complete.- Returns:
- Since:
- 3.0.5.3
-
registerSearchProvider
- Throws:
SearchException
-
unregisterSearchProvider
- Throws:
SearchException
-
getSearchInitiator
- Throws:
SearchException
-
getSubscriptionManager
- Throws:
SubscriptionException
-
supportsPowerStateControl
boolean supportsPowerStateControl(int state) -
addPowerManagementListener
-
removePowerManagementListener
-
getLocationProviders
List<LocationProvider> getLocationProviders() -
addLocationProvider
-
removeLocationProvider
-
addLocationProviderListener
-
removeLocationProviderListener
-
registerJSONRPCServer
-
unregisterJSONRPCServer
-
registerJSONRPCClient
-
unregisterJSONRPCClient
-
getDistributedDatabases
-
getDistributedDatabases
-
getScriptProviders
List<ScriptProvider> getScriptProviders() -
registerScriptProvider
-
unregisterScriptProvider
-
addScriptProviderListener
-
removeScriptProviderListener
-
getTagManager
TagManager getTagManager() -
lookupTag
-