Class Binary

  • All Implemented Interfaces:
    java.io.Serializable

    public class Binary
    extends java.lang.Object
    implements java.io.Serializable
    Generic binary holder.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Binary​(byte[] data)
      Creates a Binary object with the default binary type of 0
      Binary​(byte type, byte[] data)
      Creates a Binary object
      Binary​(BsonBinarySubType type, byte[] data)
      Creates a Binary with the specified type and data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      byte[] getData()
      Get a copy of the binary value.
      byte getType()
      Get the binary sub type as a byte.
      int hashCode()  
      int length()
      Get the length of the data.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Binary

        public Binary​(byte[] data)
        Creates a Binary object with the default binary type of 0
        Parameters:
        data - raw data
      • Binary

        public Binary​(BsonBinarySubType type,
                      byte[] data)
        Creates a Binary with the specified type and data.
        Parameters:
        type - the binary type
        data - the binary data
      • Binary

        public Binary​(byte type,
                      byte[] data)
        Creates a Binary object
        Parameters:
        type - type of the field as encoded in BSON
        data - raw data
    • Method Detail

      • getType

        public byte getType()
        Get the binary sub type as a byte.
        Returns:
        the binary sub type as a byte.
      • getData

        public byte[] getData()
        Get a copy of the binary value.
        Returns:
        a copy of the binary value.
      • length

        public int length()
        Get the length of the data.
        Returns:
        the length of the binary array.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object