org.bson
Class BSON

java.lang.Object
  extended by org.bson.BSON
Direct Known Subclasses:
Bytes

public class BSON
extends Object


Field Summary
protected static Charset _utf8
           
static byte ARRAY
           
static byte B_BINARY
           
static byte B_FUNC
           
static byte B_GENERAL
           
static byte B_UUID
           
static byte BINARY
           
static byte BOOLEAN
           
static byte CODE
           
static byte CODE_W_SCOPE
           
static byte DATE
           
static byte EOO
           
static byte MAXKEY
           
static byte MINKEY
           
static byte NULL
           
static byte NUMBER
           
static byte NUMBER_INT
           
static byte NUMBER_LONG
           
static byte OBJECT
           
static byte OID
           
static byte REF
           
static byte REGEX
           
static byte STRING
           
static byte SYMBOL
           
static byte TIMESTAMP
           
static byte UNDEFINED
           
 
Constructor Summary
BSON()
           
 
Method Summary
static void addDecodingHook(Class c, Transformer t)
           
static void addEncodingHook(Class c, Transformer t)
           
static Object applyDecodingHooks(Object o)
           
static Object applyEncodingHooks(Object o)
           
static void clearAllHooks()
           
static void clearDecodingHooks()
          Clears *all* decoding hooks.
static void clearEncodingHooks()
          Clears *all* encoding hooks.
static BSONObject decode(byte[] b)
           
static byte[] encode(BSONObject o)
           
static List<Transformer> getDecodingHooks(Class c)
          Returns the decoding hook(s) associated with the specific class
static List<Transformer> getEncodingHooks(Class c)
          Returns the encoding hook(s) associated with the specified class
static int regexFlag(char c)
           
static String regexFlags(int flags)
          Converts Java regular expression flags into a string of flags for the database
static int regexFlags(String flags)
          Converts a string of regular expression flags from the database in Java regular expression flags.
static void removeDecodingHook(Class c, Transformer t)
          Remove a specific encoding hook for a specific class.
static void removeDecodingHooks(Class c)
          Remove all decoding hooks for a specific class.
static void removeEncodingHook(Class c, Transformer t)
          Remove a specific encoding hook for a specific class.
static void removeEncodingHooks(Class c)
          Remove all encoding hooks for a specific class.
static int toInt(Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOO

public static final byte EOO
See Also:
Constant Field Values

NUMBER

public static final byte NUMBER
See Also:
Constant Field Values

STRING

public static final byte STRING
See Also:
Constant Field Values

OBJECT

public static final byte OBJECT
See Also:
Constant Field Values

ARRAY

public static final byte ARRAY
See Also:
Constant Field Values

BINARY

public static final byte BINARY
See Also:
Constant Field Values

UNDEFINED

public static final byte UNDEFINED
See Also:
Constant Field Values

OID

public static final byte OID
See Also:
Constant Field Values

BOOLEAN

public static final byte BOOLEAN
See Also:
Constant Field Values

DATE

public static final byte DATE
See Also:
Constant Field Values

NULL

public static final byte NULL
See Also:
Constant Field Values

REGEX

public static final byte REGEX
See Also:
Constant Field Values

REF

public static final byte REF
See Also:
Constant Field Values

CODE

public static final byte CODE
See Also:
Constant Field Values

SYMBOL

public static final byte SYMBOL
See Also:
Constant Field Values

CODE_W_SCOPE

public static final byte CODE_W_SCOPE
See Also:
Constant Field Values

NUMBER_INT

public static final byte NUMBER_INT
See Also:
Constant Field Values

TIMESTAMP

public static final byte TIMESTAMP
See Also:
Constant Field Values

NUMBER_LONG

public static final byte NUMBER_LONG
See Also:
Constant Field Values

MINKEY

public static final byte MINKEY
See Also:
Constant Field Values

MAXKEY

public static final byte MAXKEY
See Also:
Constant Field Values

B_GENERAL

public static final byte B_GENERAL
See Also:
Constant Field Values

B_FUNC

public static final byte B_FUNC
See Also:
Constant Field Values

B_BINARY

public static final byte B_BINARY
See Also:
Constant Field Values

B_UUID

public static final byte B_UUID
See Also:
Constant Field Values

_utf8

protected static Charset _utf8
Constructor Detail

BSON

public BSON()
Method Detail

regexFlags

public static int regexFlags(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

regexFlag

public static int regexFlag(char c)

regexFlags

public static String regexFlags(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(Class c,
                                   Transformer t)

applyEncodingHooks

public static Object applyEncodingHooks(Object o)

applyDecodingHooks

public static Object applyDecodingHooks(Object o)

getEncodingHooks

public static List<Transformer> getEncodingHooks(Class c)
Returns the encoding hook(s) associated with the specified class


clearEncodingHooks

public static void clearEncodingHooks()
Clears *all* encoding hooks.


removeEncodingHooks

public static void removeEncodingHooks(Class c)
Remove all encoding hooks for a specific class.


removeEncodingHook

public static void removeEncodingHook(Class c,
                                      Transformer t)
Remove a specific encoding hook for a specific class.


getDecodingHooks

public static List<Transformer> getDecodingHooks(Class c)
Returns the decoding hook(s) associated with the specific class


clearDecodingHooks

public static void clearDecodingHooks()
Clears *all* decoding hooks.


removeDecodingHooks

public static void removeDecodingHooks(Class c)
Remove all decoding hooks for a specific class.


removeDecodingHook

public static void removeDecodingHook(Class c,
                                      Transformer t)
Remove a specific encoding hook for a specific class.


clearAllHooks

public static void clearAllHooks()

encode

public static byte[] encode(BSONObject o)

decode

public static BSONObject decode(byte[] b)

toInt

public static int toInt(Object o)