|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.tomp2p.utils.Utils
public class Utils
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | ||
|---|---|---|
static void |
addReleaseListener(BaseFuture baseFuture,
ConnectionReservation connectionReservation,
ChannelCreator cc,
int nr)
|
|
static void |
addReleaseListenerAll(BaseFuture baseFuture,
ConnectionReservation connectionReservation,
ChannelCreator channelCreator)
|
|
static void |
bestEffortclose(Closeable... closables)
|
|
static int |
byteArrayToInt(byte[] b)
|
|
static boolean |
checkEntryProtection(Map<Number160,Data> dataMap)
|
|
static byte[] |
compress(byte[] input)
|
|
static Collection<Number160> |
convert(Collection<TrackerData> a)
|
|
static Number160 |
createRandomNodeID()
|
|
static File |
createTempDir()
|
|
static String |
debugArray(byte[] array)
|
|
static String |
debugArray(byte[] array,
int offset,
int length)
|
|
static Object |
decodeJavaObject(byte[] me,
int offset,
int length)
|
|
static Object |
decodeJavaObject(org.jboss.netty.buffer.ChannelBuffer channelBuffer)
|
|
static
|
difference(Collection<K> collection1,
Collection<K> result,
Collection<K>... collections2)
Stores the differences of multiple collections in a result collection. |
|
static
|
difference(Collection<K> collection1,
Collection<K> result,
Collection<K> collection2)
Stores the differences of two collections in a result collection. |
|
static
|
disjunction(Map<K,V> a,
Collection<K> b)
|
|
static byte[] |
encodeJavaObject(Object attachement)
|
|
static Inet4Address |
fromInteger(int address)
Returns an Inet4Address having the integer value specified by the argument. |
|
static
|
getLast(List<K> list)
|
|
static byte[] |
intToByteArray(int value)
|
|
static
|
limit(Collection<K> a,
int size)
|
|
static
|
limit(Map<K,V> a,
int i)
|
|
static Map<Number160,TrackerData> |
limitRandom(Map<Number160,TrackerData> activePeers,
int trackerSize)
|
|
static ByteBuffer |
loadFile(File file)
|
|
static Number160 |
makeSHAHash(byte[] buffer)
|
|
static Number160 |
makeSHAHash(byte[] buffer,
int offset,
int length)
|
|
static Number160 |
makeSHAHash(ByteBuffer buffer)
|
|
static Number160 |
makeSHAHash(File file)
|
|
static Number160 |
makeSHAHash(String strInput)
|
|
static
|
pollRandom(Collection<K> collection,
Random rnd)
Returns a random element from a collection. |
|
static
|
pollRandomKey(Map<K,V> queueToAsk,
Random rnd)
|
|
static
|
subtract(Collection<K> a,
Collection<K> b)
|
|
static
|
subtract(Map<K,V> a,
Collection<K> b)
|
|
static byte[] |
uncompress(byte[] compressedData)
|
|
static byte[] |
uncompress(byte[] compressedData,
int offset,
int length)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static ByteBuffer loadFile(File file)
throws IOException
IOExceptionpublic static Number160 makeSHAHash(File file)
public static Number160 makeSHAHash(String strInput)
public static Number160 makeSHAHash(ByteBuffer buffer)
public static Number160 makeSHAHash(byte[] buffer)
public static Number160 makeSHAHash(byte[] buffer,
int offset,
int length)
public static Number160 createRandomNodeID()
public static byte[] compress(byte[] input)
public static byte[] uncompress(byte[] compressedData,
int offset,
int length)
public static byte[] uncompress(byte[] compressedData)
public static byte[] encodeJavaObject(Object attachement)
throws IOException
IOException
public static Object decodeJavaObject(org.jboss.netty.buffer.ChannelBuffer channelBuffer)
throws ClassNotFoundException,
IOException
ClassNotFoundException
IOException
public static Object decodeJavaObject(byte[] me,
int offset,
int length)
throws ClassNotFoundException,
IOException
ClassNotFoundException
IOException
public static <K> Collection<K> difference(Collection<K> collection1,
Collection<K> result,
Collection<K> collection2)
collection1 - The first collection (master collection) that will be
iterated and checked against duplicates in collection2.result - The collection to store the resultcollection2 - The second collection that will be searched for
duplicates
public static <K> Collection<K> difference(Collection<K> collection1,
Collection<K> result,
Collection<K>... collections2)
collection1 - The first collection (master collection) that will be
iterated and checked against duplicates in collection2.result - The collection to store the resultcollection2 - The second collections that will be searched for
duplicates
public static void bestEffortclose(Closeable... closables)
public static final byte[] intToByteArray(int value)
public static final int byteArrayToInt(byte[] b)
public static <K> K pollRandom(Collection<K> collection,
Random rnd)
List and fetches a random
element using List.get(int).
collection - The collection from which we want to pick a random
elementrnd - The random object
public static <K,V> Map.Entry<K,V> pollRandomKey(Map<K,V> queueToAsk,
Random rnd)
public static <K> Collection<K> subtract(Collection<K> a,
Collection<K> b)
public static <K,V> Map<K,V> subtract(Map<K,V> a,
Collection<K> b)
public static <K,V> Map<K,V> disjunction(Map<K,V> a,
Collection<K> b)
public static <K> Collection<K> limit(Collection<K> a,
int size)
public static <K,V> Map<K,V> limit(Map<K,V> a,
int i)
public static Collection<Number160> convert(Collection<TrackerData> a)
public static String debugArray(byte[] array,
int offset,
int length)
public static String debugArray(byte[] array)
public static boolean checkEntryProtection(Map<Number160,Data> dataMap)
public static void addReleaseListener(BaseFuture baseFuture,
ConnectionReservation connectionReservation,
ChannelCreator cc,
int nr)
public static void addReleaseListenerAll(BaseFuture baseFuture,
ConnectionReservation connectionReservation,
ChannelCreator channelCreator)
public static Map<Number160,TrackerData> limitRandom(Map<Number160,TrackerData> activePeers,
int trackerSize)
public static <K> K getLast(List<K> list)
public static Inet4Address fromInteger(int address)
address - int, the 32bit integer address to be converted
Inet4Address equivalent of the argument
public static File createTempDir()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||