Class ByteUtils
java.lang.Object
net.rubyeye.xmemcached.utils.ByteUtils
Utilities for byte process
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int[]static final Charsetstatic final String(package private) static final byte[](package private) static final byte[]All possible chars for representing a number as a String(package private) static final byte[]static final booleanstatic final org.slf4j.Loggerprivate static intprivate static Protocol(package private) static final int[]static final ByteBufferstatic booleanif it is testing,check key argument even if use binary protocol. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbyte2hex(byte b, StringBuffer buf) static final voidcheckKey(byte[] keyBytes) static final void(package private) static voidgetBytes(int i, int index, byte[] buf) Places characters representing the integer i into the character array buf.static voidgetBytes(long i, int index, byte[] buf) static final byte[]static StringgetString(byte[] bytes) static byteint0(int x) static byteint1(int x) static byteint2(int x) static voidint2hex(int a, StringBuffer str) static byteint3(int x) static booleanstatic booleanstatic bytelong0(long x) static bytelong1(long x) static bytelong2(long x) static bytelong3(long x) static bytelong4(long x) static bytelong5(long x) static bytelong6(long x) static bytelong7(long x) static final StringnextLine(ByteBuffer buffer) Read next line from ByteBufferstatic final intnormalizeCapacity(int requestedCapacity) static final intsetArguments(byte[] bb, int index, Object... args) static final voidsetArguments(IoBuffer bb, Object... args) static voidsetProtocol(Protocol protocol) static byteshort0(short x) static byteshort1(short x) static voidshort2hex(int a, StringBuffer str) static final booleanstepBuffer(ByteBuffer buffer, int remaining) static final intstringSize(int x) static final intstringSize(long x)
-
Field Details
-
log
public static final org.slf4j.Logger log -
DEFAULT_CHARSET_NAME
- See Also:
-
DEFAULT_CHARSET
-
SPLIT
-
ENABLE_FAST_STRING_ENCODER
public static final boolean ENABLE_FAST_STRING_ENCODER -
testing
public static boolean testingif it is testing,check key argument even if use binary protocol. The user must never change this value at all. -
memcachedProtocol
-
maxKeyLength
private static int maxKeyLength -
digits
static final byte[] digitsAll possible chars for representing a number as a String -
DigitTens
static final byte[] DigitTens -
DigitOnes
static final byte[] DigitOnes -
sizeTable
static final int[] sizeTable -
byte_len_array
static final int[] byte_len_array
-
-
Constructor Details
-
ByteUtils
private ByteUtils()
-
-
Method Details
-
isValidString
-
isNumber
-
getBytes
-
setArguments
-
setArguments
-
checkKey
public static final void checkKey(byte[] keyBytes) -
checkKey
-
setProtocol
-
normalizeCapacity
public static final int normalizeCapacity(int requestedCapacity) -
stepBuffer
-
nextLine
Read next line from ByteBuffer- Parameters:
buffer-- Returns:
-
getString
-
byte2hex
-
int2hex
-
short2hex
-
getBytes
public static void getBytes(long i, int index, byte[] buf) -
getBytes
static void getBytes(int i, int index, byte[] buf) Places characters representing the integer i into the character array buf. The characters are placed into the buffer backwards starting with the least significant digit at the specified index (exclusive), and working backwards from there. Will fail if i == Integer.MIN_VALUE -
stringSize
public static final int stringSize(int x) -
stringSize
public static final int stringSize(long x) -
int3
public static byte int3(int x) -
int2
public static byte int2(int x) -
int1
public static byte int1(int x) -
int0
public static byte int0(int x) -
short1
public static byte short1(short x) -
short0
public static byte short0(short x) -
long7
public static byte long7(long x) -
long6
public static byte long6(long x) -
long5
public static byte long5(long x) -
long4
public static byte long4(long x) -
long3
public static byte long3(long x) -
long2
public static byte long2(long x) -
long1
public static byte long1(long x) -
long0
public static byte long0(long x)
-