public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addReleaseListener(BaseFuture baseFuture,
ChannelCreator cc,
int nr) |
static void |
addReleaseListenerAll(BaseFuture baseFuture,
ChannelCreator cc) |
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 String |
debugArray(byte[] array) |
static String |
debugArray(byte[] array,
int offset,
int length) |
static Object |
decodeJavaObject(byte[] me,
int offset,
int length) |
static <K> void |
difference(Collection<K> newNeighbors,
Collection<K> alreadyAsked,
Collection<K> result) |
static DigestInfo |
digest(Digest storage,
Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys) |
static <K,V> Map<K,V> |
disjunction(Map<K,V> a,
Collection<K> b) |
static byte[] |
encodeJavaObject(Object attachement) |
static byte[] |
intToByteArray(int value) |
static <K> Collection<K> |
limit(Collection<K> a,
int size) |
static <K,V> Map<K,V> |
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 PeerAddress |
pollFirst(SortedSet<PeerAddress> queue) |
static <K> K |
pollRandom(SortedSet<K> queueToAsk,
Random rnd) |
static <K,V> Map.Entry<K,V> |
pollRandomKey(Map<K,V> queueToAsk,
Random rnd) |
static void |
sleep(long connectionTimeout) |
static <K> Collection<K> |
subtract(Collection<K> a,
Collection<K> b) |
static <K,V> Map<K,V> |
subtract(Map<K,V> a,
Collection<K> b) |
static byte[] |
uncompress(byte[] compressedData) |
static byte[] |
uncompress(byte[] compressedData,
int offset,
int length) |
public static ByteBuffer loadFile(File file) throws IOException
IOExceptionpublic 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 void sleep(long connectionTimeout)
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
IOExceptionpublic static Object decodeJavaObject(byte[] me, int offset, int length) throws ClassNotFoundException, IOException
ClassNotFoundExceptionIOExceptionpublic static <K> void difference(Collection<K> newNeighbors, Collection<K> alreadyAsked, Collection<K> result)
public static void bestEffortclose(Closeable... closables)
public static PeerAddress pollFirst(SortedSet<PeerAddress> queue)
public static final byte[] intToByteArray(int value)
public static final int byteArrayToInt(byte[] b)
public static DigestInfo digest(Digest storage, Number160 locationKey, Number160 domainKey, Collection<Number160> contentKeys)
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 Collection<Number160> convert(Collection<TrackerData> a)
public static String debugArray(byte[] array, int offset, int length)
public static String debugArray(byte[] array)
public static void addReleaseListener(BaseFuture baseFuture, ChannelCreator cc, int nr)
public static void addReleaseListenerAll(BaseFuture baseFuture, ChannelCreator cc)
public static Map<Number160,TrackerData> limitRandom(Map<Number160,TrackerData> activePeers, int trackerSize)
Copyright © 2011. All Rights Reserved.