public class Bson extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Bson.BinaryType
The bytes used for the subtypes of a binary value within a BSON stream.
|
static class |
Bson.Type
The bytes used for the types within a BSON stream.
|
Modifier and Type | Field and Description |
---|---|
static String |
DATE_FORMAT |
protected static String |
DATE_FORMAT_FOR_PARSING |
static byte |
END_OF_DOCUMENT
Byte used for the end of a document within a BSON stream.
|
static byte |
END_OF_STRING
Byte used for the end of a string within a BSON stream.
|
Constructor and Description |
---|
Bson() |
Modifier and Type | Method and Description |
---|---|
protected static BsonWriter |
getBsonWriter() |
static DateFormat |
getDateFormatter()
Obtain a
DateFormat object that can be used within the current thread to format Date objects. |
static DateFormat |
getDateParsingFormatter() |
protected static BsonReader |
getReader() |
static int |
getTypeForValue(Object value)
Get the
Bson.Type constant that describes the type of value for the given field name. |
static Document |
read(DataInput input)
Read the binary BSON representation from supplied data input and construct the
Document representation. |
static Document |
read(InputStream stream)
Read the binary BSON representation from supplied input stream and construct the
Document representation. |
static void |
write(Document bson,
ObjectOutput output)
Write to the supplied output the binary BSON representation of the supplied in-memory
Document . |
static void |
write(Document bson,
OutputStream stream)
Write to the supplied stream the binary BSON representation of the supplied in-memory
Document . |
static byte[] |
write(Object object)
Return the array of bytes containing the standard BSON binary form of the supplied in-memory
Document . |
public static final String DATE_FORMAT
protected static final String DATE_FORMAT_FOR_PARSING
public static final byte END_OF_DOCUMENT
public static final byte END_OF_STRING
public static DateFormat getDateFormatter()
DateFormat
object that can be used within the current thread to format Date
objects.public static DateFormat getDateParsingFormatter()
protected static BsonWriter getBsonWriter()
public static void write(Document bson, OutputStream stream) throws IOException
Document
.bson
- the BSON object or BSON value; may not be nullstream
- the output stream; may not be nullIOException
- if there was a problem writing to the streampublic static void write(Document bson, ObjectOutput output) throws IOException
Document
.bson
- the BSON object or BSON value; may not be nulloutput
- the output; may not be nullIOException
- if there was a problem writing to the ObjectOutputpublic static byte[] write(Object object) throws IOException
Document
.object
- the BSON object or BSON value; may not be nullIOException
- if there was a problem reading from the streamprotected static BsonReader getReader()
public static Document read(InputStream stream) throws IOException
Document
representation.stream
- the input stream; may not be nullDocument
representationIOException
- if there was a problem reading from the streampublic static Document read(DataInput input) throws IOException
Document
representation.input
- the data input; may not be nullDocument
representationIOException
- if there was a problem reading from the streamCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.