Package org.bson

Class RawBsonArray

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<BsonValue>, java.util.Collection<BsonValue>, java.util.List<BsonValue>

    public class RawBsonArray
    extends BsonArray
    implements java.io.Serializable
    An immutable BSON array that is represented using only the raw bytes.
    Since:
    3.7
    See Also:
    Serialized Form
    • Constructor Detail

      • RawBsonArray

        public RawBsonArray​(byte[] bytes)
        Constructs a new instance with the given byte array. Note that it does not make a copy of the array, so do not modify it after passing it to this constructor.
        Parameters:
        bytes - the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it after passing it to this construction, unless of course that is your intention.
      • RawBsonArray

        public RawBsonArray​(byte[] bytes,
                            int offset,
                            int length)
        Constructs a new instance with the given byte array, offset, and length. Note that it does not make a copy of the array, so do not modify it after passing it to this constructor.
        Parameters:
        bytes - the bytes representing a BSON document. Note that the byte array is NOT copied, so care must be taken not to modify it after passing it to this construction, unless of course that is your intention.
        offset - the offset into the byte array
        length - the length of the subarray to use
    • Method Detail

      • add

        public boolean add​(BsonValue bsonValue)
        Specified by:
        add in interface java.util.Collection<BsonValue>
        Specified by:
        add in interface java.util.List<BsonValue>
        Overrides:
        add in class BsonArray
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<BsonValue>
        Specified by:
        remove in interface java.util.List<BsonValue>
        Overrides:
        remove in class BsonArray
      • addAll

        public boolean addAll​(java.util.Collection<? extends BsonValue> c)
        Specified by:
        addAll in interface java.util.Collection<BsonValue>
        Specified by:
        addAll in interface java.util.List<BsonValue>
        Overrides:
        addAll in class BsonArray
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends BsonValue> c)
        Specified by:
        addAll in interface java.util.List<BsonValue>
        Overrides:
        addAll in class BsonArray
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<BsonValue>
        Specified by:
        removeAll in interface java.util.List<BsonValue>
        Overrides:
        removeAll in class BsonArray
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<BsonValue>
        Specified by:
        retainAll in interface java.util.List<BsonValue>
        Overrides:
        retainAll in class BsonArray
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<BsonValue>
        Specified by:
        clear in interface java.util.List<BsonValue>
        Overrides:
        clear in class BsonArray
      • add

        public void add​(int index,
                        BsonValue element)
        Specified by:
        add in interface java.util.List<BsonValue>
        Overrides:
        add in class BsonArray
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<BsonValue>
        Specified by:
        equals in interface java.util.List<BsonValue>
        Overrides:
        equals in class BsonArray
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<BsonValue>
        Specified by:
        hashCode in interface java.util.List<BsonValue>
        Overrides:
        hashCode in class BsonArray