Class BinaryValue

  • All Implemented Interfaces:
    Value

    public class BinaryValue
    extends BaseValue
    A BinaryValue provides an implementation of the Value interface representing a binary value.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int TYPE  
    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryValue​(byte[] data)
      Constructs a BinaryValue object based on a byte array.
      BinaryValue​(java.io.InputStream stream)
      Constructs a BinaryValue object based on a stream.
      BinaryValue​(java.lang.String text)
      Constructs a BinaryValue object based on a string.
      BinaryValue​(Binary bin)
      Constructs a BinaryValue object based on a Binary.
    • Constructor Detail

      • BinaryValue

        public BinaryValue​(java.lang.String text)
        Constructs a BinaryValue object based on a string.
        Parameters:
        text - the string this BinaryValue should represent
      • BinaryValue

        public BinaryValue​(Binary bin)
        Constructs a BinaryValue object based on a Binary.
        Parameters:
        bin - the bytes this BinaryValue should represent
      • BinaryValue

        public BinaryValue​(java.io.InputStream stream)
        Constructs a BinaryValue object based on a stream.
        Parameters:
        stream - the stream this BinaryValue should represent
      • BinaryValue

        public BinaryValue​(byte[] data)
        Constructs a BinaryValue object based on a byte array.
        Parameters:
        data - the bytes this BinaryValue should represent
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this one.

        The result is true if and only if the argument is not null and is a BinaryValue object that represents the same value as this object.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        always zero
        See Also:
        Object.hashCode()
      • getStream

        public java.io.InputStream getStream()
                                      throws java.lang.IllegalStateException,
                                             RepositoryException
        Returns an InputStream representation of this value. Uses the standard conversion to binary (see JCR specification).

        It is the responsibility of the caller to close the returned InputStream.

        Specified by:
        getStream in interface Value
        Overrides:
        getStream in class BaseValue
        Returns:
        An InputStream representation of this value.
        Throws:
        RepositoryException - if an error occurs.
        java.lang.IllegalStateException