Package net.sf.saxon.value
Class HexBinaryValue
- java.lang.Object
-
- net.sf.saxon.value.AtomicValue
-
- net.sf.saxon.value.HexBinaryValue
-
- All Implemented Interfaces:
java.lang.Comparable<XPathComparable>
,java.lang.Iterable<AtomicValue>
,AtomicMatchKey
,XPathComparable
,AtomicSequence
,GroundedValue
,IdentityComparable
,Item
,Sequence
,ConversionResult
,ContextFreeAtomicValue
public class HexBinaryValue extends AtomicValue implements AtomicMatchKey, XPathComparable, ContextFreeAtomicValue
A value of type xs:hexBinary
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.value.AtomicValue
typeLabel
-
-
Constructor Summary
Constructors Constructor Description HexBinaryValue(byte[] value)
Constructor: create a hexBinary value from a given array of bytesHexBinaryValue(UnicodeString in)
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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(XPathComparable o)
AtomicValue
copyAsSubType(AtomicType typeLabel)
Create a primitive copy of this atomic value (usually so that the type label can be changed).boolean
equals(java.lang.Object other)
Test if the two hexBinary or Base64Binaryvalues are equal.byte[]
getBinaryValue()
Get the binary valueint
getLengthInOctets()
Get the number of octets in the valueUnicodeString
getPrimitiveStringValue()
Convert to stringBuiltInAtomicType
getPrimitiveType()
Determine the primitive type of the value.XPathComparable
getXPathComparable()
Get an XPathComparable object that supports the semantics of context-free eq and lt comparisons between atomic values.XPathComparable
getXPathComparable(StringCollator collator, int implicitTimezone)
Get an object value that implements the XPath equality and ordering comparison semantics for this value.AtomicMatchKey
getXPathMatchKey(StringCollator collator, int implicitTimezone)
Get an object value that implements the XPath equality and ordering comparison semantics for this value.int
hashCode()
Returns a hash code value for the object.-
Methods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, asMapKey, atomize, checkPermittedContents, checkValidInJavascript, effectiveBooleanValue, getCanonicalLexicalRepresentation, getCardinality, getComponent, getGenre, getItemType, getLength, getUnicodeStringValue, getUType, head, identityHashCode, isIdentical, isIdentical, isNaN, isUntypedAtomic, itemAt, iterate, iterator, setTypeLabel, show, toShortString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.expr.sort.AtomicMatchKey
asAtomic
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getStringValue, isStreamed, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
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
-
-
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 classAtomicValue
- 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 classAtomicValue
- Returns:
- the primitive type
-
getBinaryValue
public byte[] getBinaryValue()
Get the binary value- Returns:
- the binary value, as a byte array
-
getPrimitiveStringValue
public UnicodeString getPrimitiveStringValue()
Convert to string- Specified by:
getPrimitiveStringValue
in classAtomicValue
- Returns:
- the canonical representation.
-
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)
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:
getXPathMatchKey
in classAtomicValue
- Parameters:
collator
- collation to be used for comparing stringsimplicitTimezone
- to be used for comparing dates/times with no timezone- Returns:
- a key used for performing the comparison
-
getXPathComparable
public XPathComparable getXPathComparable(StringCollator collator, int implicitTimezone)
Description copied from class:AtomicValue
Get an object value that implements the XPath equality and ordering 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. An atomic value may return itself as the result, provided that its ordering rules are independent of the collation and timezone, and provided that it implements the XPathComparable interface: which means that its compareTo, equals, and hashCode methods must be compatible with the rules for XPath value comparisons.- Specified by:
getXPathComparable
in classAtomicValue
- Parameters:
collator
- the collation to be used when comparing stringsimplicitTimezone
- the implicit timezone in the dynamic context, used when comparing dates/times with and without timezone- Returns:
- an Object that implements the XPath value comparison semantics with respect to this atomic value. For an atomic type that is not ordered (according to XPath rules), return null.
-
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 genericComparable
interface, this cannot be assumed.- Specified by:
getXPathComparable
in interfaceContextFreeAtomicValue
- 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 classAtomicValue
- 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 classAtomicValue
-
compareTo
public int compareTo(XPathComparable o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<XPathComparable>
-
-