|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.littleshoot.util.CommonUtils
public class CommonUtils
General utilities specific to LittleShoot.
| Field Summary | |
|---|---|
static int |
FREE_RESULT_LIMIT
The maximum number of search results for a single source for the free version. |
static String |
LIMEWIRE_ENABLED_KEY
|
static String |
SEEDING_ENABLED_KEY
|
static String |
UPLOAD_SPEED_KEY
|
| Method Summary | |
|---|---|
static byte[] |
combine(byte[]... arrays)
Combines the specified arrays into a single array. |
static byte[] |
combine(Collection<byte[]> arrays)
Combines the specified arrays into a single array. |
static byte[] |
decodeAllMessages(byte[] key,
byte[] msgs)
|
static byte[] |
decodeBase64(String base64)
|
static byte[] |
decodeSingleMessage(byte[] key,
byte[] msg)
|
static byte[] |
decodeSingleMessage(byte[] key,
byte[] msg,
AtomicInteger atomicOffset)
|
static byte[] |
encode(byte[] key,
byte[] data,
int off,
int len)
|
static byte[] |
encodeSingleMessage(byte[] key,
byte[] data,
int off,
int len)
|
static String |
generateBase64Key()
|
static byte[] |
generateKey()
|
static File |
getDataDir()
Gets the directory to use for LittleShoot data. |
static File |
getLittleShootDir()
|
static Properties |
getProps()
|
static File |
getPropsFile()
|
static byte[] |
intToByteArray(int value)
Converts an int to an unsigned byte array. |
static boolean |
isPro()
Returns whether or not this is LittleShoot Pro. |
static boolean |
isPropertyTrue(String key)
|
static boolean |
isStringTrue(String str)
|
static boolean |
isTrue(String varName)
|
static String |
nativeCall(String... commands)
Makes a native call with the specified commands, returning the result. |
static String |
nativeCall(String fullCommand)
Makes a native call with a full string argument that will be parsed into separate command line tokens with white space delimiters. |
static int |
randomPort()
|
static void |
saveProps(Properties props)
|
static void |
setProperty(String key,
String value)
|
static void |
threadedCopy(InputStream is,
OutputStream os,
String threadName)
|
static String |
toHex(byte[] data)
|
static String |
toString(byte[] bytes)
|
static int |
unsignedShortToInt(byte[] b)
Converts a two byte array to an integer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FREE_RESULT_LIMIT
public static final String LIMEWIRE_ENABLED_KEY
public static final String SEEDING_ENABLED_KEY
public static final String UPLOAD_SPEED_KEY
| Method Detail |
|---|
public static String toString(byte[] bytes)
public static void threadedCopy(InputStream is,
OutputStream os,
String threadName)
public static File getDataDir()
public static boolean isPro()
true if we're running Pro, otherwise
falsepublic static File getLittleShootDir()
public static boolean isTrue(String varName)
public static boolean isPropertyTrue(String key)
public static boolean isStringTrue(String str)
public static File getPropsFile()
public static Properties getProps()
public static void saveProps(Properties props)
public static void setProperty(String key,
String value)
public static String nativeCall(String fullCommand)
fullCommand - The full command as you would write it on the
command line.
public static String nativeCall(String... commands)
commands - The commands separated into individual arguments.
public static byte[] combine(byte[]... arrays)
arrays - The arrays to combine.
public static byte[] combine(Collection<byte[]> arrays)
arrays - The arrays to combine.
public static byte[] encode(byte[] key,
byte[] data,
int off,
int len)
public static byte[] encodeSingleMessage(byte[] key,
byte[] data,
int off,
int len)
public static byte[] decodeAllMessages(byte[] key,
byte[] msgs)
public static byte[] decodeSingleMessage(byte[] key,
byte[] msg)
public static byte[] decodeSingleMessage(byte[] key,
byte[] msg,
AtomicInteger atomicOffset)
public static byte[] generateKey()
public static String generateBase64Key()
public static byte[] decodeBase64(String base64)
public static String toHex(byte[] data)
public static final int unsignedShortToInt(byte[] b)
b - a byte array of length 2
public static final byte[] intToByteArray(int value)
value - The int.
public static int randomPort()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||