net.rubyeye.xmemcached.utils
Class ByteUtils

java.lang.Object
  extended by net.rubyeye.xmemcached.utils.ByteUtils

public final class ByteUtils
extends java.lang.Object

Utilities for byte process

Author:
dennis

Field Summary
static java.nio.charset.Charset DEFAULT_CHARSET
           
static java.lang.String DEFAULT_CHARSET_NAME
           
static org.slf4j.Logger log
           
static java.nio.ByteBuffer SPLIT
           
static boolean testing
          if it is testing,check key argument even if use binary protocol.
 
Method Summary
static void byte2hex(byte b, java.lang.StringBuffer buf)
           
static void checkKey(byte[] keyBytes)
           
static void checkKey(java.lang.String key)
           
static byte[] getBytes(java.lang.String k)
           
static java.lang.String getString(byte[] bytes)
           
static void int2hex(int a, java.lang.StringBuffer str)
           
static java.lang.String nextLine(java.nio.ByteBuffer buffer)
          获取下一行
static int normalizeCapacity(int requestedCapacity)
           
static void setArguments(IoBuffer bb, java.lang.Object... args)
           
static void setProtocol(Protocol protocol)
           
static void short2hex(int a, java.lang.StringBuffer str)
           
static boolean stepBuffer(java.nio.ByteBuffer buffer, int remaining)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.slf4j.Logger log

DEFAULT_CHARSET_NAME

public static final java.lang.String DEFAULT_CHARSET_NAME
See Also:
Constant Field Values

DEFAULT_CHARSET

public static final java.nio.charset.Charset DEFAULT_CHARSET

SPLIT

public static final java.nio.ByteBuffer SPLIT

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

getBytes

public static final byte[] getBytes(java.lang.String k)

setArguments

public static final void setArguments(IoBuffer bb,
                                      java.lang.Object... args)

checkKey

public static final void checkKey(byte[] keyBytes)

checkKey

public static final void checkKey(java.lang.String key)

setProtocol

public static void setProtocol(Protocol protocol)

normalizeCapacity

public static final int normalizeCapacity(int requestedCapacity)

stepBuffer

public static final boolean stepBuffer(java.nio.ByteBuffer buffer,
                                       int remaining)

nextLine

public static final java.lang.String nextLine(java.nio.ByteBuffer buffer)
获取下一行

Parameters:
buffer -

getString

public static java.lang.String getString(byte[] bytes)

byte2hex

public static void byte2hex(byte b,
                            java.lang.StringBuffer buf)

int2hex

public static void int2hex(int a,
                           java.lang.StringBuffer str)

short2hex

public static void short2hex(int a,
                             java.lang.StringBuffer str)


Copyright © 2011. All Rights Reserved.