org.elasticsearch.util
Class Bytes

java.lang.Object
  extended by org.elasticsearch.util.Bytes

public class Bytes
extends java.lang.Object


Field Summary
static java.lang.ThreadLocal<ThreadLocals.CleanableValue<byte[]>> cachedBytes
           
static byte[] EMPTY_ARRAY
           
 
Constructor Summary
Bytes()
           
 
Method Summary
static int atoi(byte[] s)
           
static long atol(byte[] s)
           
static byte[] itoa(int i)
          Blatant copy of Integer.toString, but returning a byte array instead of a String, as string charset decoding/encoding was killing us on performance.
static byte[] ltoa(long i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachedBytes

public static java.lang.ThreadLocal<ThreadLocals.CleanableValue<byte[]>> cachedBytes

EMPTY_ARRAY

public static final byte[] EMPTY_ARRAY
Constructor Detail

Bytes

public Bytes()
Method Detail

itoa

public static byte[] itoa(int i)
Blatant copy of Integer.toString, but returning a byte array instead of a String, as string charset decoding/encoding was killing us on performance.

Parameters:
i - integer to convert
Returns:
byte[] array containing literal ASCII char representation

atoi

public static int atoi(byte[] s)
                throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

ltoa

public static byte[] ltoa(long i)

atol

public static long atol(byte[] s)
                 throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException