com.mongodb
Class Bytes

java.lang.Object
  extended by com.mongodb.Bytes
Direct Known Subclasses:
ByteDecoder, ByteEncoder

public class Bytes
extends Object

Handles byte functions for ByteEncoder and ByteDecoder.


Field Summary
protected static Charset _utf8
           
protected static int MAX_STRING
          The maximum number of bytes allowed to be sent to the db at a time
static ByteOrder ORDER
          Little-endian
static int QUERYOPTION_NOTIMEOUT
           
static int QUERYOPTION_OPLOGREPLAY
           
static int QUERYOPTION_SLAVEOK
           
static int QUERYOPTION_TAILABLE
           
 
Constructor Summary
Bytes()
           
 
Method Summary
static void addDecodingHook(byte type, Transformer t)
           
static void addEncodingHook(Class c, Transformer t)
           
static Object applyDecodingHooks(byte b, Object o)
           
static Object applyEncodingHooks(Object o)
           
static void clearAllHooks()
           
static DBObject decode(byte[] b)
           
static byte[] encode(DBObject o)
           
static int getFlag(char c)
           
static byte getType(Object o)
          Gets the type byte for a given object.
static String patternFlags(int flags)
          Converts Java regular expression flags into a string of flags for the database
static int patternFlags(String flags)
          Converts a string of regular expression flags from the database in Java regular expression flags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORDER

public static final ByteOrder ORDER
Little-endian


QUERYOPTION_TAILABLE

public static final int QUERYOPTION_TAILABLE
See Also:
Constant Field Values

QUERYOPTION_SLAVEOK

public static final int QUERYOPTION_SLAVEOK
See Also:
Constant Field Values

QUERYOPTION_OPLOGREPLAY

public static final int QUERYOPTION_OPLOGREPLAY
See Also:
Constant Field Values

QUERYOPTION_NOTIMEOUT

public static final int QUERYOPTION_NOTIMEOUT
See Also:
Constant Field Values

_utf8

protected static Charset _utf8

MAX_STRING

protected static final int MAX_STRING
The maximum number of bytes allowed to be sent to the db at a time

See Also:
Constant Field Values
Constructor Detail

Bytes

public Bytes()
Method Detail

getType

public static byte getType(Object o)
Gets the type byte for a given object.

Parameters:
o - the object
Returns:
the byte value associated with the type, or 0 if o was null

patternFlags

public static int patternFlags(String flags)
Converts a string of regular expression flags from the database in Java regular expression flags.

Parameters:
flags - flags from database
Returns:
the Java flags

getFlag

public static int getFlag(char c)

patternFlags

public static String patternFlags(int flags)
Converts Java regular expression flags into a string of flags for the database

Parameters:
flags - Java flags
Returns:
the flags for the database

addEncodingHook

public static void addEncodingHook(Class c,
                                   Transformer t)

addDecodingHook

public static void addDecodingHook(byte type,
                                   Transformer t)

applyEncodingHooks

public static Object applyEncodingHooks(Object o)

applyDecodingHooks

public static Object applyDecodingHooks(byte b,
                                        Object o)

clearAllHooks

public static void clearAllHooks()

encode

public static byte[] encode(DBObject o)

decode

public static DBObject decode(byte[] b)