ModeShape Distribution 3.0.0.Beta4

org.infinispan.schematic.internal.document
Class BsonUtils

java.lang.Object
  extended by org.infinispan.schematic.internal.document.BsonUtils

public class BsonUtils
extends Object


Constructor Summary
BsonUtils()
           
 
Method Summary
static ObjectId readObjectId(byte[] bytes)
          The BSON specification (or rather the MongoDB documentation) defines the structure of this data: "A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter.
static ObjectId readObjectId(String bytesInHex)
          Read the ObjectId from the hexadecimal string representation of the ObjectId.
static String regexFlagsFor(int flags)
           
static String regexFlagsFor(Pattern pattern)
           
static int regexFlagsFrom(String flags)
           
static boolean valuesAreEqual(Object thisValue, Object thatValue)
           
static void writeObjectId(ObjectId id, byte[] b)
          Write the 12-byte representation of the ObjectId per the BSON specification (or rather the MongoDB documentation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BsonUtils

public BsonUtils()
Method Detail

regexFlagsFrom

public static int regexFlagsFrom(String flags)

regexFlagsFor

public static String regexFlagsFor(Pattern pattern)

regexFlagsFor

public static String regexFlagsFor(int flags)

readObjectId

public static ObjectId readObjectId(byte[] bytes)
The BSON specification (or rather the MongoDB documentation) defines the structure of this data:

"A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order."

Parameters:
bytes -
Returns:
the ObjectId

readObjectId

public static ObjectId readObjectId(String bytesInHex)
Read the ObjectId from the hexadecimal string representation of the ObjectId.

Parameters:
bytesInHex - the hexadecimal identifier
Returns:
the ObjectId

writeObjectId

public static void writeObjectId(ObjectId id,
                                 byte[] b)
Write the 12-byte representation of the ObjectId per the BSON specification (or rather the MongoDB documentation).

Parameters:
id - the ObjectId; may not be null
b - the bytes into which the object ID should be written

valuesAreEqual

public static boolean valuesAreEqual(Object thisValue,
                                     Object thatValue)

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.