net.tomp2p.utils
Class Utils
java.lang.Object
net.tomp2p.utils.Utils
public class Utils
- extends Object
|
Constructor Summary |
Utils()
|
|
Method Summary |
static void |
bestEffortclose(Closeable... closables)
|
static int |
byteArrayToInt(byte[] b)
|
static byte[] |
compress(byte[] input)
|
static Number160 |
createRandomNodeID()
|
static Object |
decodeJavaObject(byte[] me,
int offset,
int length)
|
static void |
difference(Collection<PeerAddress> newNeighbors,
Collection<PeerAddress> alreadyAsked,
Collection<PeerAddress> result)
|
static DigestInfo |
digest(Storage storage,
Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys)
|
static byte[] |
encodeJavaObject(Object attachement)
|
static byte[] |
intToByteArray(int value)
|
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 void |
sleep(long connectionTimeout)
|
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 |
Utils
public Utils()
loadFile
public static ByteBuffer loadFile(File file)
throws IOException
- Throws:
IOException
makeSHAHash
public static Number160 makeSHAHash(File file)
makeSHAHash
public static Number160 makeSHAHash(String strInput)
makeSHAHash
public static Number160 makeSHAHash(ByteBuffer buffer)
makeSHAHash
public static Number160 makeSHAHash(byte[] buffer)
makeSHAHash
public static Number160 makeSHAHash(byte[] buffer,
int offset,
int length)
createRandomNodeID
public static Number160 createRandomNodeID()
sleep
public static void sleep(long connectionTimeout)
compress
public static byte[] compress(byte[] input)
uncompress
public static byte[] uncompress(byte[] compressedData,
int offset,
int length)
uncompress
public static byte[] uncompress(byte[] compressedData)
encodeJavaObject
public static byte[] encodeJavaObject(Object attachement)
throws IOException
- Throws:
IOException
decodeJavaObject
public static Object decodeJavaObject(byte[] me,
int offset,
int length)
throws ClassNotFoundException,
IOException
- Throws:
ClassNotFoundException
IOException
difference
public static void difference(Collection<PeerAddress> newNeighbors,
Collection<PeerAddress> alreadyAsked,
Collection<PeerAddress> result)
bestEffortclose
public static void bestEffortclose(Closeable... closables)
pollFirst
public static PeerAddress pollFirst(SortedSet<PeerAddress> queue)
intToByteArray
public static final byte[] intToByteArray(int value)
byteArrayToInt
public static final int byteArrayToInt(byte[] b)
digest
public static DigestInfo digest(Storage storage,
Number160 locationKey,
Number160 domainKey,
Collection<Number160> contentKeys)
Copyright © 2011. All Rights Reserved.