Class HexBinaryValue

    • Constructor Detail

      • HexBinaryValue

        public HexBinaryValue​(UnicodeString in)
                       throws XPathException
        Constructor: create a hexBinary value from a supplied string, in which each octet is represented by a pair of values from 0-9, a-f, A-F
        Parameters:
        in - character representation of the hexBinary value
        Throws:
        XPathException - if the input is invalid
      • HexBinaryValue

        public HexBinaryValue​(byte[] value)
        Constructor: create a hexBinary value from a given array of bytes
        Parameters:
        value - the value as an array of bytes
      • HexBinaryValue

        public HexBinaryValue​(byte[] value,
                              AtomicType typeLabel)
        Constructor: create a hexBinary value from a given array of bytes and a specified type label
        Parameters:
        value - the value as an array of bytes
        typeLabel - the type label, which must be a subtype of HEX_BINARY
    • Method Detail

      • copyAsSubType

        public AtomicValue copyAsSubType​(AtomicType typeLabel)
        Create a primitive copy of this atomic value (usually so that the type label can be changed).
        Specified by:
        copyAsSubType in class AtomicValue
        Parameters:
        typeLabel - the target type (a derived type from hexBinary)
        Returns:
        the copied value
      • getPrimitiveType

        public BuiltInAtomicType getPrimitiveType()
        Determine the primitive type of the value. This delivers the same answer as getItemType().getPrimitiveItemType(). The primitive types are the 19 primitive types of XML Schema, plus xs:integer, xs:dayTimeDuration and xs:yearMonthDuration, and xs:untypedAtomic. For external objects, the result is AnyAtomicType.
        Specified by:
        getPrimitiveType in class AtomicValue
        Returns:
        the primitive type
      • getBinaryValue

        public byte[] getBinaryValue()
        Get the binary value
        Returns:
        the binary value, as a byte array
      • getLengthInOctets

        public int getLengthInOctets()
        Get the number of octets in the value
        Returns:
        the number of octets (bytes) in the value
      • getXPathMatchKey

        public AtomicMatchKey getXPathMatchKey​(StringCollator collator,
                                               int implicitTimezone)
        Description copied from class: AtomicValue
        Get an object value that implements the XPath equality comparison semantics for this value. A collation is supplied for comparing strings, and an implicit timezone for comparing date/time values that have no saved timezone. The returned object supports equality matching only, not ordering. An atomic value may return itself as its own AtomicMatchKey provided that its equality semantics are context-free.
        Specified by:
        getXPathMatchKey in class AtomicValue
        Parameters:
        collator - the collation to be used when comparing strings
        implicitTimezone - the implicit timezone in the dynamic context, used when comparing dates/times with and without timezone
        Returns:
        an Object whose equals() and hashCode() methods implement the XPath comparison semantics with respect to this atomic value. If ordered is specified, the result will either be null if no ordering is defined, or will be a Comparable
      • getXPathComparable

        public XPathComparable getXPathComparable​(StringCollator collator,
                                                  int implicitTimezone)
        Get an object value that implements the XPath equality and ordering comparison semantics for this value. If the ordered parameter is set to true, the result will be a Comparable and will support a compareTo() method with the semantics of the XPath lt/gt operator, provided that the other operand is also obtained using the getXPathComparable() method. In all cases the result will support equals() and hashCode() methods that support the semantics of the XPath eq operator, again provided that the other operand is also obtained using the getXPathComparable() method. A context argument is supplied for use in cases where the comparison semantics are context-sensitive, for example where they depend on the implicit timezone or the default collation.
        Specified by:
        getXPathComparable in class AtomicValue
        Parameters:
        collator - collation to be used for comparing strings
        implicitTimezone - to be used for comparing dates/times with no timezone
        Returns:
        a key used for performing the comparison
      • getXPathComparable

        public XPathComparable getXPathComparable()
        Description copied from interface: ContextFreeAtomicValue
        Get an XPathComparable object that supports the semantics of context-free eq and lt comparisons between atomic values. Note that in many cases the returned XPathComparable will be the AtomicValue itself; however because of the constraints of the generic Comparable interface, this cannot be assumed.
        Specified by:
        getXPathComparable in interface ContextFreeAtomicValue
        Returns:
        an XPathComparable that can be used in comparisons with other atomic values.
      • equals

        public boolean equals​(java.lang.Object other)
        Test if the two hexBinary or Base64Binaryvalues are equal.
        Overrides:
        equals in class AtomicValue
        Parameters:
        other - the other value
        Returns:
        true (in a subclass) if the other operand is an atomic value and the two values are equal as defined by the XPath eq operator
      • hashCode

        public int hashCode()
        Description copied from class: AtomicValue
        Returns a hash code value for the object.
        Overrides:
        hashCode in class AtomicValue