Class BinaryValue


  • public class BinaryValue
    extends Object
    Class used to represent Binary Values. This is required in particular when the user wants to use the value in a file. To be able to reflect this this object is used: it contains the binary itself, the base 64 representation and the file that has been used.
    • Method Detail

      • createBase64

        public static BinaryValue createBase64​(String base64)
                                        throws ParseException
        Creates a binary value using a base64 string.
        Parameters:
        base64 - the base64 representation of the binary.
        Returns:
        the binary value.
        Throws:
        ParseException - if there is an error decoding the provided base64 string.
      • createBase64

        public static BinaryValue createBase64​(byte[] bytes)
        Creates a binary value using an array of bytes.
        Parameters:
        bytes - the byte array.
        Returns:
        the binary value.
      • createFromFile

        public static BinaryValue createFromFile​(byte[] bytes,
                                                 File file)
        Creates a binary value using an array of bytes and a file.
        Parameters:
        bytes - the bytes in the file.
        file - the file the bytes were read from.
        Returns:
        the binary value.
      • getBase64

        public String getBase64()
        Returns the base64 representation of the binary value.
        Returns:
        the base64 representation of the binary value.
      • getBytes

        public byte[] getBytes()
                        throws ParseException
        Returns the byte array of the binary value.
        Returns:
        the byte array of the binary value.
        Throws:
        ParseException - if this object was created using a base64 string and there was an error parsing it.
      • getType

        public BinaryValue.Type getType()
        Return the type of the binary value.
        Returns:
        the type of the binary value.
      • getFile

        public File getFile()
        Return the file that was used to read the binary value.
        Returns:
        the file that was used to read the binary value.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object