FileDocCategorySizeDatePackage
Utilities.javaAPI DocAzureus 3.0.3.47469Thu Jun 28 16:08:26 BST 2007org.gudy.azureus2.plugins.utils

Utilities

public interface Utilities
author
parg

Fields Summary
Constructors Summary
Methods Summary
public java.nio.ByteBufferallocateDirectByteBuffer(int size)

public PooledByteBufferallocatePooledByteBuffer(int size)

public PooledByteBufferallocatePooledByteBuffer(byte[] data)

public PooledByteBufferallocatePooledByteBuffer(java.util.Map data)

param
data must be b-encodable
return

public intcompareVersions(java.lang.String v1, java.lang.String v2)
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"); // +

param
v1 the first version string to be compared
param
v2 the second version string to be compared
return
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

public AggregatedDispatchercreateAggregatedDispatcher(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 time

param
idle_dispatch_time milliseconds
param
max_queue_size 0 -> infinite
return

public AggregatedListcreateAggregatedList(AggregatedListAcceptor acceptor, long idle_dispatch_time, long max_queue_size)

public voidcreateProcess(java.lang.String command_line)
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

param
command_line

public voidcreateThread(java.lang.String name, java.lang.Runnable target)
create and run a thread for the target. This will be a daemon thread so that its existence doesn't interfere with Azureus closedown

param
name
param
target

public UTTimercreateTimer(java.lang.String name)
Creates a UTTimer instance.

param
name Name for the UTTimer object.
return
A UTTimer instance.

public UTTimercreateTimer(java.lang.String name, boolean lightweight)
Creates a UTTimer instance.

param
name Name for the UTTimer object.
param
lightweight If true, it indicates that this timer will be used to perform small lightweight tasks. If false, 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.
return
A UTTimer instance.

public UTTimercreateTimer(java.lang.String name, int priority)
Creates a UTTimer instance.

param
name Name for the UTTimer object.
param
priority The Thread.XXX_PRIORITY value to use.
return
A UTTimer instance.

public ByteArrayWrappercreateWrapper(byte[] data)

public voidfreeDirectByteBuffer(java.nio.ByteBuffer buffer)

public java.lang.StringgetAzureusProgramDir()

public java.lang.StringgetAzureusUserDir()

public longgetCurrentSystemTime()
Get the current system time, like System.currentTimeMillis(), only the time lookup is cached for performance reasons.

return
current system time

public FormattersgetFormatters()

public java.io.InputStreamgetImageAsStream(java.lang.String image_name)

public LocaleUtilitiesgetLocaleUtilities()

public MonitorgetMonitor()

public java.net.InetAddressgetPublicAddress()
Returns a public IP address of the machine or null if it can't be determined

public java.net.InetAddressgetPublicAddress(boolean ipv6)

public RSSFeedgetRSSFeed(java.net.URL feed_location)

public RSSFeedgetRSSFeed(ResourceDownloader feed_location)

public ResourceDownloaderFactorygetResourceDownloaderFactory()

public org.gudy.azureus2.plugins.utils.resourceuploader.ResourceUploaderFactorygetResourceUploaderFactory()

public SESecurityManagergetSecurityManager()

public SemaphoregetSemaphore()

public SimpleXMLParserDocumentFactorygetSimpleXMLParserDocumentFactory()

public booleanisCVSVersion()

public booleanisFreeBSD()

return
Whether the OS is FreeBSD
note
Up to at least v2.4.0.2, the FreeBSD port has identified itself to azureus as Linux and not FreeBSD
since
2.4.0.3

public booleanisLinux()

public booleanisOSX()

public booleanisSolaris()

public booleanisUnix()

return
Whether the OS is a unix flavor (linux, bsd, aix, etc)
since
2.4.0.3

public booleanisWindows()

public java.lang.StringnormaliseFileName(java.lang.String f_name)
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.

param
f_name File name to convert.
return
Converted file name.

public java.util.MapreadResilientBEncodedFile(java.io.File parent_dir, java.lang.String file_name, boolean use_backup)

public java.lang.StringreverseDNSLookup(java.net.InetAddress address)
attempts a reverse DNS lookup of an address, null if it fails

param
address
return

public voidwriteResilientBEncodedFile(java.io.File parent_dir, java.lang.String file_name, java.util.Map data, boolean use_backup)