Package net.rubyeye.xmemcached.utils
Class ByteUtils
- java.lang.Object
-
- net.rubyeye.xmemcached.utils.ByteUtils
-
public final class ByteUtils extends Object
Utilities for byte process- Author:
- dennis
-
-
Field Summary
Fields Modifier and Type Field Description static CharsetDEFAULT_CHARSETstatic StringDEFAULT_CHARSET_NAMEstatic booleanENABLE_FAST_STRING_ENCODERstatic org.slf4j.Loggerlogstatic ByteBufferSPLITstatic booleantestingif it is testing,check key argument even if use binary protocol.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbyte2hex(byte b, StringBuffer buf)static voidcheckKey(byte[] keyBytes)static voidcheckKey(String key)static voidgetBytes(long i, int index, byte[] buf)static byte[]getBytes(String k)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 booleanisNumber(String string)static booleanisValidString(String s)static 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 StringnextLine(ByteBuffer buffer)Read next line from ByteBufferstatic intnormalizeCapacity(int requestedCapacity)static intsetArguments(byte[] bb, int index, Object... args)static voidsetArguments(IoBuffer bb, Object... args)static voidsetProtocol(Protocol protocol)static byteshort0(short x)static byteshort1(short x)static voidshort2hex(int a, StringBuffer str)static booleanstepBuffer(ByteBuffer buffer, int remaining)static intstringSize(int x)static intstringSize(long x)
-
-
-
Field Detail
-
log
public static final org.slf4j.Logger log
-
DEFAULT_CHARSET_NAME
public static final String DEFAULT_CHARSET_NAME
- See Also:
- Constant Field Values
-
DEFAULT_CHARSET
public static final Charset DEFAULT_CHARSET
-
SPLIT
public static final ByteBuffer SPLIT
-
ENABLE_FAST_STRING_ENCODER
public static final boolean ENABLE_FAST_STRING_ENCODER
-
testing
public static boolean testing
if it is testing,check key argument even if use binary protocol. The user must never change this value at all.
-
-
Method Detail
-
isValidString
public static boolean isValidString(String s)
-
isNumber
public static boolean isNumber(String string)
-
getBytes
public static final byte[] getBytes(String k)
-
setArguments
public static final int setArguments(byte[] bb, int index, Object... args)
-
checkKey
public static final void checkKey(byte[] keyBytes)
-
checkKey
public static final void checkKey(String key)
-
setProtocol
public static void setProtocol(Protocol protocol)
-
normalizeCapacity
public static final int normalizeCapacity(int requestedCapacity)
-
stepBuffer
public static final boolean stepBuffer(ByteBuffer buffer, int remaining)
-
nextLine
public static final String nextLine(ByteBuffer buffer)
Read next line from ByteBuffer- Parameters:
buffer-- Returns:
-
getString
public static String getString(byte[] bytes)
-
byte2hex
public static void byte2hex(byte b, StringBuffer buf)
-
int2hex
public static void int2hex(int a, StringBuffer str)
-
short2hex
public static void short2hex(int a, StringBuffer str)
-
getBytes
public static void getBytes(long i, int index, byte[] buf)
-
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)
-
-