org.apache.cassandra.utils
Class FBUtilities
java.lang.Object
org.apache.cassandra.utils.FBUtilities
public class FBUtilities
- extends java.lang.Object
Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
Method Summary |
static int |
byteArrayToInt(byte[] bytes)
|
static int |
byteArrayToInt(byte[] bytes,
int offset)
|
static int |
compareByteArrays(byte[] bytes1,
byte[] bytes2)
|
static int |
compareBytes(byte b1,
byte b2)
|
static int |
compareBytes(int b1,
int b2)
|
static byte[] |
compress(byte[] input)
|
static void |
compressToStream(byte[] input,
java.io.ByteArrayOutputStream bos)
|
static byte[] |
decompress(byte[] compressedData)
|
static byte[] |
decompress(byte[] compressedData,
int off,
int len)
|
static java.lang.Object |
deserializeFromStream(byte[] bytes)
|
static int |
getBits(int x,
int p,
int n)
|
static java.lang.String |
getCurrentThreadStackTrace()
|
static java.lang.String |
getHostAddress()
|
static java.net.InetAddress |
getLocalAddress()
|
static java.lang.String |
getTimestamp()
|
static java.lang.String |
getTimestamp(long value)
|
static int |
getUTF8Length(java.lang.String string)
|
static java.math.BigInteger |
hash(java.lang.String data)
|
static byte[] |
hash(java.lang.String type,
byte[] data)
|
static boolean |
isEqual(byte[] digestA,
byte[] digestB)
|
static boolean |
isEqualBits(byte[] bytes1,
byte[] bytes2)
|
static boolean |
isHostLocalHost(java.net.InetAddress host)
|
static byte[] |
serializeToStream(java.lang.Object o)
|
static java.lang.String |
stackTrace(java.lang.Throwable e)
|
static java.lang.String[] |
strip(java.lang.String string,
java.lang.String token)
|
static byte[] |
toByteArray(int i)
|
static byte[] |
xor(byte[] b1,
byte[] b2)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FBUtilities
public FBUtilities()
getTimestamp
public static java.lang.String getTimestamp()
getTimestamp
public static java.lang.String getTimestamp(long value)
getBits
public static int getBits(int x,
int p,
int n)
getCurrentThreadStackTrace
public static java.lang.String getCurrentThreadStackTrace()
strip
public static java.lang.String[] strip(java.lang.String string,
java.lang.String token)
serializeToStream
public static byte[] serializeToStream(java.lang.Object o)
deserializeFromStream
public static java.lang.Object deserializeFromStream(byte[] bytes)
getLocalAddress
public static java.net.InetAddress getLocalAddress()
throws java.net.UnknownHostException
- Throws:
java.net.UnknownHostException
getHostAddress
public static java.lang.String getHostAddress()
throws java.net.UnknownHostException
- Throws:
java.net.UnknownHostException
isHostLocalHost
public static boolean isHostLocalHost(java.net.InetAddress host)
toByteArray
public static byte[] toByteArray(int i)
byteArrayToInt
public static int byteArrayToInt(byte[] bytes)
byteArrayToInt
public static int byteArrayToInt(byte[] bytes,
int offset)
isEqualBits
public static boolean isEqualBits(byte[] bytes1,
byte[] bytes2)
compareByteArrays
public static int compareByteArrays(byte[] bytes1,
byte[] bytes2)
compareBytes
public static int compareBytes(byte b1,
byte b2)
compareBytes
public static int compareBytes(int b1,
int b2)
stackTrace
public static java.lang.String stackTrace(java.lang.Throwable e)
hash
public static java.math.BigInteger hash(java.lang.String data)
hash
public static byte[] hash(java.lang.String type,
byte[] data)
isEqual
public static boolean isEqual(byte[] digestA,
byte[] digestB)
compressToStream
public static void compressToStream(byte[] input,
java.io.ByteArrayOutputStream bos)
throws java.io.IOException
- Throws:
java.io.IOException
compress
public static byte[] compress(byte[] input)
throws java.io.IOException
- Throws:
java.io.IOException
decompress
public static byte[] decompress(byte[] compressedData,
int off,
int len)
throws java.io.IOException,
java.util.zip.DataFormatException
- Throws:
java.io.IOException
java.util.zip.DataFormatException
decompress
public static byte[] decompress(byte[] compressedData)
throws java.io.IOException,
java.util.zip.DataFormatException
- Throws:
java.io.IOException
java.util.zip.DataFormatException
xor
public static byte[] xor(byte[] b1,
byte[] b2)
getUTF8Length
public static int getUTF8Length(java.lang.String string)
Copyright © 2009 The Apache Software Foundation