public class LazyBSONObject extends java.lang.Object implements BSONObject
BSONObject
backed by a byte buffer that lazily provides keys and values on request. This is useful for transferring
BSON documents between servers when you don't want to pay the performance penalty of encoding or decoding them fully.Constructor and Description |
---|
LazyBSONObject(byte[] bytes,
int offset,
LazyBSONCallback callback)
Construct an instance.
|
LazyBSONObject(byte[] bytes,
LazyBSONCallback callback)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsField(java.lang.String s)
Checks if this object contains a field with the given name.
|
boolean |
containsKey(java.lang.String key)
Deprecated.
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet()
Gets the entry set for all the key/value pairs in this
BSONObject . |
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(java.lang.String key)
Gets a field from this object by a given name.
|
int |
getBSONSize()
Gets the size in bytes of the BSON document.
|
int |
hashCode() |
boolean |
isEmpty()
Gets whether this is an empty
BSONObject . |
java.util.Set<java.lang.String> |
keySet()
Returns this object's fields' names
|
int |
pipe(java.io.OutputStream os)
Pipe the raw bytes into the given output stream.
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object v)
Always throws
UnsupportedOperationException . |
void |
putAll(BSONObject o)
Always throws
UnsupportedOperationException . |
void |
putAll(java.util.Map m)
Always throws
UnsupportedOperationException . |
java.lang.Object |
removeField(java.lang.String key)
Always throws
UnsupportedOperationException . |
java.util.Map |
toMap()
Returns a map representing this BSONObject.
|
public LazyBSONObject(byte[] bytes, LazyBSONCallback callback)
bytes
- the raw bytescallback
- the callback to use to construct nested valuespublic LazyBSONObject(byte[] bytes, int offset, LazyBSONCallback callback)
bytes
- the raw bytesoffset
- the offset into the raw bytes representing the start of the documentcallback
- the callback to use to construct nested valuespublic java.lang.Object get(java.lang.String key)
BSONObject
get
in interface BSONObject
key
- The name of the field fetch@Deprecated public boolean containsKey(java.lang.String key)
BSONObject
containsKey
in interface BSONObject
key
- the key to checkpublic boolean containsField(java.lang.String s)
BSONObject
containsField
in interface BSONObject
s
- Field name for which to checkpublic java.util.Set<java.lang.String> keySet()
BSONObject
keySet
in interface BSONObject
public boolean isEmpty()
BSONObject
.public int getBSONSize()
public int pipe(java.io.OutputStream os) throws java.io.IOException
os
- the output streamjava.io.IOException
- any IOException thrown by the output streampublic java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
BSONObject
. The returned set is immutable.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.Object put(java.lang.String key, java.lang.Object v)
UnsupportedOperationException
.put
in interface BSONObject
key
- Name to setv
- Corresponding valuejava.lang.UnsupportedOperationException
- the object is read onlypublic void putAll(BSONObject o)
UnsupportedOperationException
.putAll
in interface BSONObject
o
- the objectjava.lang.UnsupportedOperationException
- the object is read onlypublic void putAll(java.util.Map m)
UnsupportedOperationException
.putAll
in interface BSONObject
m
- the mapjava.lang.UnsupportedOperationException
- the object is read onlypublic java.lang.Object removeField(java.lang.String key)
UnsupportedOperationException
.removeField
in interface BSONObject
key
- The name of the field to removejava.lang.UnsupportedOperationException
- the object is read onlypublic java.util.Map toMap()
BSONObject
toMap
in interface BSONObject
Copyright © 2010 - 2020 Adobe. All Rights Reserved