Package net.sf.saxon.value
Class BinaryValue
java.lang.Object
net.sf.saxon.value.AtomicValue
net.sf.saxon.value.BinaryValue
- All Implemented Interfaces:
Comparable<XPathComparable>,Iterable<AtomicValue>,AtomicMatchKey,XPathComparable,AtomicSequence,GroundedValue,IdentityComparable,Item,Sequence,ConversionResult
- Direct Known Subclasses:
Base64BinaryValue,HexBinaryValue
A value of type xs:hexBinary or xs:base64Binary
-
Field Summary
FieldsFields inherited from class net.sf.saxon.value.AtomicValue
metadata -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMapKey(int specVersion) Get a value whose equals() method follows the "same key" rules for comparing the keys of a map.protected static intbyteArrayHashCode(byte[] value) intbooleanTest if the two hexBinary or Base64Binary values are equal.byte[]Get the binary valueintGet the number of octets in the valuegetXPathComparable(StringCollator collator, int implicitTimezone, int specVersion) Get an object value that implements the XPath equality and ordering comparison semantics for this value.getXPathMatchKey(StringCollator collator, int implicitTimezone, int specVersion) Get an object value that implements the XPath equality comparison semantics for this value.inthashCode()Returns a hash code value for the object.booleanstartsWith(byte[] bytes) Test whether the value starts with a given octet sequenceMethods inherited from class net.sf.saxon.value.AtomicValue
asAtomic, atomize, checkPermittedContents, checkValidInJavascript, effectiveBooleanValue, getCanonicalLexicalRepresentation, getCardinality, getComponent, getGenre, getItemType, getLabel, getLength, getPrimitiveStringValue, getPrimitiveType, getUnicodeStringValue, getUType, head, identityHashCode, isIdentical, isIdentical, isNaN, isUntypedAtomic, itemAt, iterate, iterator, show, toShortString, toString, withMetadataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.expr.sort.AtomicMatchKey
asAtomic, longHashCodeMethods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materializeMethods inherited from interface net.sf.saxon.om.Item
getStringValue, isStreamed, reduce, subsequenceMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Field Details
-
binaryValue
protected final byte[] binaryValue
-
-
Constructor Details
-
BinaryValue
-
-
Method Details
-
byteArrayHashCode
protected static int byteArrayHashCode(byte[] value) -
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
-
startsWith
public boolean startsWith(byte[] bytes) Test whether the value starts with a given octet sequence -
getXPathMatchKey
public AtomicMatchKey getXPathMatchKey(StringCollator collator, int implicitTimezone, int specVersion) Description copied from class:AtomicValueGet 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 ownAtomicMatchKeyprovided that its equality semantics are context-free.- Specified by:
getXPathMatchKeyin 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 timezonespecVersion- the version of the XPath specification, typically 31 or 40- 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
-
asMapKey
Description copied from class:AtomicValueGet a value whose equals() method follows the "same key" rules for comparing the keys of a map.- Overrides:
asMapKeyin classAtomicValue- Returns:
- a value with the property that the equals() and hashCode() methods follow the rules for comparing keys in maps.
-
getXPathComparable
public XPathComparable getXPathComparable(StringCollator collator, int implicitTimezone, int specVersion) 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:
getXPathComparablein classAtomicValue- Parameters:
collator- collation to be used for comparing stringsimplicitTimezone- to be used for comparing dates/times with no timezonespecVersion- the semantics of binary comparison change in XPath 4.0- Returns:
- a key used for performing the comparison
-
equals
Test if the two hexBinary or Base64Binary values are equal. This implements the 4.0 semantics (hexBinary and base64Binary are comparable)- Overrides:
equalsin 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:AtomicValueReturns a hash code value for the object.- Overrides:
hashCodein classAtomicValue
-
compareTo
- Specified by:
compareToin interfaceComparable<XPathComparable>
-