public class FBUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_UNSIGNED_SHORT |
static java.math.BigInteger |
TWO |
Constructor and Description |
---|
FBUtilities() |
Modifier and Type | Method and Description |
---|---|
static long |
abs(long index) |
static java.io.File |
cassandraTriggerDir() |
static <T> java.lang.Class<T> |
classForName(java.lang.String classname,
java.lang.String readable) |
static <T> CloseableIterator<T> |
closeableIterator(java.util.Iterator<T> iterator) |
static int |
compareUnsigned(byte[] bytes1,
byte[] bytes2) |
static int |
compareUnsigned(byte[] bytes1,
byte[] bytes2,
int offset1,
int offset2,
int len1,
int len2) |
static <T> T |
construct(java.lang.String classname,
java.lang.String readable)
Constructs an instance of the given class, which must have a no-arg or default constructor.
|
static long |
copy(java.io.InputStream from,
java.io.OutputStream to,
long limit) |
static void |
deserialize(org.apache.thrift.TDeserializer deserializer,
org.apache.thrift.TBase struct,
java.io.DataInput in)
Deprecated.
|
static void |
exec(java.lang.ProcessBuilder pb)
Starts and waits for the given @param pb to finish.
|
static java.util.List<java.lang.String> |
fromJsonList(java.lang.String json) |
static java.util.Map<java.lang.String,java.lang.String> |
fromJsonMap(java.lang.String json) |
static java.util.Collection<java.net.InetAddress> |
getAllLocalAddresses() |
static int |
getAvailableProcessors() |
static java.net.InetAddress |
getBroadcastAddress() |
static java.net.InetAddress |
getLocalAddress()
Please use getBroadcastAddress instead.
|
static java.lang.reflect.Field |
getProtectedField(java.lang.Class klass,
java.lang.String fieldName)
Used to get access to protected/private field of the specified class
|
static java.lang.String |
getReleaseVersionString() |
static java.io.File |
getToolsOutputDirectory() |
static byte[] |
hash(java.nio.ByteBuffer... data) |
static java.math.BigInteger |
hashToBigInteger(java.nio.ByteBuffer data) |
static boolean |
hasProcFS() |
static boolean |
isWindows() |
static java.lang.String |
json(java.lang.Object object) |
static Pair<java.math.BigInteger,java.lang.Boolean> |
midpoint(java.math.BigInteger left,
java.math.BigInteger right,
int sigbits)
Given two bit arrays represented as BigIntegers, containing the given
number of significant bits, calculate a midpoint.
|
static IAuthenticator |
newAuthenticator(java.lang.String className) |
static IAuthorizer |
newAuthorizer(java.lang.String className) |
static java.security.MessageDigest |
newMessageDigest(java.lang.String algorithm) |
static IAllocator |
newOffHeapAllocator(java.lang.String offheap_allocator) |
static IPartitioner |
newPartitioner(java.lang.String partitionerClassName) |
static java.lang.String |
prettyPrintMemory(long size) |
static java.lang.String |
resourceToFile(java.lang.String filename) |
static <T> byte[] |
serialize(T object,
IVersionedSerializer<T> serializer,
int version) |
static void |
serialize(org.apache.thrift.TSerializer serializer,
org.apache.thrift.TBase struct,
java.io.DataOutput out)
Deprecated.
|
static <T> java.util.SortedSet<T> |
singleton(T column,
java.util.Comparator<? super T> comparator) |
static void |
sortSampledKeys(java.util.List<DecoratedKey> keys,
Range<Token> range) |
static java.security.MessageDigest |
threadLocalMD5Digest() |
static long |
timestampMicros() |
static java.lang.String |
toString(java.util.Map<?,?> map) |
static void |
updateChecksumInt(java.util.zip.Checksum checksum,
int v) |
static void |
updateWithByte(java.security.MessageDigest digest,
int val) |
static void |
updateWithInt(java.security.MessageDigest digest,
int val) |
static void |
updateWithLong(java.security.MessageDigest digest,
long val) |
static void |
updateWithShort(java.security.MessageDigest digest,
int val) |
static <T> T |
waitOnFuture(java.util.concurrent.Future<T> future) |
static void |
waitOnFutures(java.lang.Iterable<java.util.concurrent.Future<?>> futures) |
static void |
waitOnFutures(java.util.List<AsyncOneResponse> results,
long ms) |
static byte[] |
xor(byte[] left,
byte[] right) |
public static final java.math.BigInteger TWO
public static final int MAX_UNSIGNED_SHORT
public static int getAvailableProcessors()
public static java.security.MessageDigest threadLocalMD5Digest()
public static java.security.MessageDigest newMessageDigest(java.lang.String algorithm)
public static java.net.InetAddress getLocalAddress()
public static java.net.InetAddress getBroadcastAddress()
public static java.util.Collection<java.net.InetAddress> getAllLocalAddresses()
public static Pair<java.math.BigInteger,java.lang.Boolean> midpoint(java.math.BigInteger left, java.math.BigInteger right, int sigbits)
left
- The left point.right
- The right point.sigbits
- The number of bits in the points that are significant.public static int compareUnsigned(byte[] bytes1, byte[] bytes2, int offset1, int offset2, int len1, int len2)
public static int compareUnsigned(byte[] bytes1, byte[] bytes2)
public static byte[] xor(byte[] left, byte[] right)
public static byte[] hash(java.nio.ByteBuffer... data)
public static java.math.BigInteger hashToBigInteger(java.nio.ByteBuffer data)
@Deprecated public static void serialize(org.apache.thrift.TSerializer serializer, org.apache.thrift.TBase struct, java.io.DataOutput out) throws java.io.IOException
java.io.IOException
@Deprecated public static void deserialize(org.apache.thrift.TDeserializer deserializer, org.apache.thrift.TBase struct, java.io.DataInput in) throws java.io.IOException
java.io.IOException
public static void sortSampledKeys(java.util.List<DecoratedKey> keys, Range<Token> range)
public static java.lang.String resourceToFile(java.lang.String filename) throws ConfigurationException
ConfigurationException
public static java.io.File cassandraTriggerDir()
public static java.lang.String getReleaseVersionString()
public static long timestampMicros()
public static void waitOnFutures(java.lang.Iterable<java.util.concurrent.Future<?>> futures)
public static <T> T waitOnFuture(java.util.concurrent.Future<T> future)
public static void waitOnFutures(java.util.List<AsyncOneResponse> results, long ms) throws java.util.concurrent.TimeoutException
java.util.concurrent.TimeoutException
public static IPartitioner newPartitioner(java.lang.String partitionerClassName) throws ConfigurationException
ConfigurationException
public static IAllocator newOffHeapAllocator(java.lang.String offheap_allocator) throws ConfigurationException
ConfigurationException
public static IAuthorizer newAuthorizer(java.lang.String className) throws ConfigurationException
ConfigurationException
public static IAuthenticator newAuthenticator(java.lang.String className) throws ConfigurationException
ConfigurationException
public static <T> java.lang.Class<T> classForName(java.lang.String classname, java.lang.String readable) throws ConfigurationException
classname
- Fully qualified classname.readable
- Descriptive noun for the role the class plays.ConfigurationException
- If the class cannot be found.public static <T> T construct(java.lang.String classname, java.lang.String readable) throws ConfigurationException
classname
- Fully qualified classname.readable
- Descriptive noun for the role the class plays.ConfigurationException
- If the class cannot be found.public static <T> java.util.SortedSet<T> singleton(T column, java.util.Comparator<? super T> comparator)
public static java.lang.String toString(java.util.Map<?,?> map)
public static java.lang.reflect.Field getProtectedField(java.lang.Class klass, java.lang.String fieldName)
klass
- - name of the classfieldName
- - name of the fieldpublic static <T> CloseableIterator<T> closeableIterator(java.util.Iterator<T> iterator)
public static java.util.Map<java.lang.String,java.lang.String> fromJsonMap(java.lang.String json)
public static java.util.List<java.lang.String> fromJsonList(java.lang.String json)
public static java.lang.String json(java.lang.Object object)
public static java.lang.String prettyPrintMemory(long size)
public static void exec(java.lang.ProcessBuilder pb) throws java.io.IOException
java.io.IOException
- on non-zero exit codepublic static void updateChecksumInt(java.util.zip.Checksum checksum, int v)
public static long abs(long index)
public static <T> byte[] serialize(T object, IVersionedSerializer<T> serializer, int version)
public static long copy(java.io.InputStream from, java.io.OutputStream to, long limit) throws java.io.IOException
java.io.IOException
public static java.io.File getToolsOutputDirectory()
public static boolean isWindows()
public static boolean hasProcFS()
public static void updateWithShort(java.security.MessageDigest digest, int val)
public static void updateWithByte(java.security.MessageDigest digest, int val)
public static void updateWithInt(java.security.MessageDigest digest, int val)
public static void updateWithLong(java.security.MessageDigest digest, long val)
Copyright © 2015 The Apache Software Foundation