Class Base64BinaryValue

All Implemented Interfaces:
Comparable<XPathComparable>, Iterable<AtomicValue>, AtomicMatchKey, XPathComparable, AtomicSequence, GroundedValue, IdentityComparable, Item, Sequence, ConversionResult

public class Base64BinaryValue extends BinaryValue
A value of type xs:base64Binary
  • Constructor Details

    • Base64BinaryValue

      public Base64BinaryValue(UnicodeString s) throws XPathException
      Constructor: create a base64Binary value from a supplied string in base64 encoding
      Parameters:
      s - the lexical representation of the base64 binary value. There is no requirement that whitespace should already be collapsed.
      Throws:
      XPathException - if the supplied value is not in the lexical space of the xs:base64Binary data type
    • Base64BinaryValue

      public Base64BinaryValue(byte[] value)
      Constructor: create a base64Binary value from a given array of bytes
      Parameters:
      value - array of bytes holding the octet sequence
    • Base64BinaryValue

      public Base64BinaryValue(byte[] value, AtomicMetadata metadata)
      Constructor: create a base64Binary value from a given array of bytes
      Parameters:
      value - array of bytes holding the octet sequence
      metadata - the specific type (must be a subtype of BASE64_BINARY)
  • Method Details

    • withMetadata

      public AtomicValue withMetadata(AtomicMetadata metadata)
      Create a copy of this atomic value (usually so that the type label can be changed). The type label of the copy will be reset to the primitive type.
      Specified by:
      withMetadata in class AtomicValue
      Parameters:
      metadata - the type label to be attached to the value, a subtype of xs:base64Binary
      Returns:
      the copied value
    • getPrimitiveType

      public BuiltInAtomicType getPrimitiveType()
      Description copied from class: AtomicValue
      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 xs:anyAtomicType.
      Specified by:
      getPrimitiveType in class AtomicValue
      Returns:
      the primitive type
    • getPrimitiveStringValue

      public UnicodeString getPrimitiveStringValue()
      Convert to string
      Specified by:
      getPrimitiveStringValue in class AtomicValue
      Returns:
      the canonical representation.
    • encode

      public static UnicodeString encode(byte[] value)
      Encode a byte sequence into base64 representation
      Parameters:
      value - the byte sequence
      Returns:
      the base64 representation
    • decode

      public static byte[] decode(UnicodeString in) throws XPathException
      Decode a character string in base64 notation to yield the encoded octets
      Parameters:
      in - the lexical representation
      Returns:
      the array of octets represented
      Throws:
      XPathException - if the format is invalid (as required by XSD, this method does draconian error handling, unlike many other base64 decoders which are liberal in what they accept)
    • compareTo

      public int compareTo(XPathComparable o)
      Specified by:
      compareTo in interface Comparable<XPathComparable>
      Overrides:
      compareTo in class BinaryValue