1 /* Copyright 2004 The Apache Software Foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package org.apache.xmlbeans; 17 18 import javax.xml.stream.XMLStreamReader; 19 20 21 /** 22 * Corresponds to the XML Schema 23 * <a target="_blank" href="http://www.w3.org/TR/xmlschema-2/#hexBinary">xs:hexBinary</a> type. 24 * <p> 25 * Convertible to a byte array. 26 */ 27 public interface XmlHexBinary extends XmlAnySimpleType 28 { 29 /** The constant {@link SchemaType} object representing this schema type. */ 30 public static final SchemaType type = XmlBeans.getBuiltinTypeSystem().typeForHandle("_BI_hexBinary"); 31 32 /** 33 * Returns this value as a byte array. 34 * @deprecated replaced by {@link #getByteArrayValue} 35 **/ 36 byte[] byteArrayValue(); 37 38 /** 39 * Sets this value as a byte array. 40 * @deprecated replaced by {@link #setByteArrayValue} 41 **/ 42 void set(byte[] ba); 43 44 /** Returns this value as a byte array. **/ 45 byte[] getByteArrayValue(); 46 /** Sets this value as a byte array. */ 47 void setByteArrayValue(byte[] ba); 48 49 50 51 /** 52 * A class with methods for creating instances 53 * of {@link XmlHexBinary}. 54 */ 55 public static final class Factory 56 { 57 /** Creates an empty instance of {@link XmlHexBinary} */ 58 public static XmlHexBinary newInstance() { 59 return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance( type, null ); } 60 61 /** Creates an empty instance of {@link XmlHexBinary} */ 62 public static XmlHexBinary newInstance(org.apache.xmlbeans.XmlOptions options) { 63 return (XmlHexBinary) XmlBeans.getContextTypeLoader().newInstance( type, options ); } 64 65 /** Creates an immutable {@link XmlHexBinary} value */ 66 public static XmlHexBinary newValue(Object obj) { 67 return (XmlHexBinary) type.newValue( obj ); } 68 69 /** Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>". */ 70 public static XmlHexBinary parse(java.lang.String s) throws org.apache.xmlbeans.XmlException { 71 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( s, type, null ); } 72 73 /** Parses a {@link XmlHexBinary} fragment from a String. For example: "<code><xml-fragment>68656c6c6f</xml-fragment></code>". */ 74 public static XmlHexBinary parse(java.lang.String s, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 75 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( s, type, options ); } 76 77 /** Parses a {@link XmlHexBinary} fragment from a File. */ 78 public static XmlHexBinary parse(java.io.File f) throws org.apache.xmlbeans.XmlException, java.io.IOException { 79 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( f, type, null ); } 80 81 /** Parses a {@link XmlHexBinary} fragment from a File. */ 82 public static XmlHexBinary parse(java.io.File f, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 83 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( f, type, options ); } 84 85 /** Parses a {@link XmlHexBinary} fragment from a URL. */ 86 public static XmlHexBinary parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { 87 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( u, type, null ); } 88 89 /** Parses a {@link XmlHexBinary} fragment from a URL. */ 90 public static XmlHexBinary parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 91 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( u, type, options ); } 92 93 /** Parses a {@link XmlHexBinary} fragment from an InputStream. */ 94 public static XmlHexBinary parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { 95 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( is, type, null ); } 96 97 /** Parses a {@link XmlHexBinary} fragment from an InputStream. */ 98 public static XmlHexBinary parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 99 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( is, type, options ); } 100 101 /** Parses a {@link XmlHexBinary} fragment from a Reader. */ 102 public static XmlHexBinary parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { 103 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( r, type, null ); } 104 105 /** Parses a {@link XmlHexBinary} fragment from a Reader. */ 106 public static XmlHexBinary parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { 107 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( r, type, options ); } 108 109 /** Parses a {@link XmlHexBinary} fragment from a DOM Node. */ 110 public static XmlHexBinary parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { 111 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( node, type, null ); } 112 113 /** Parses a {@link XmlHexBinary} fragment from a DOM Node. */ 114 public static XmlHexBinary parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { 115 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( node, type, options ); } 116 117 /** Parses a {@link XmlHexBinary} fragment from an XMLInputStream. 118 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 119 */ 120 public static XmlHexBinary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 121 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xis, type, null ); } 122 123 /** Parses a {@link XmlHexBinary} fragment from an XMLInputStream. 124 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 125 */ 126 public static XmlHexBinary parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 127 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xis, type, options ); } 128 129 /** Parses a {@link XmlHexBinary} fragment from an XMLStreamReader. */ 130 public static XmlHexBinary parse(javax.xml.stream.XMLStreamReader xsr) throws org.apache.xmlbeans.XmlException { 131 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xsr, type, null ); } 132 133 /** Parses a {@link XmlHexBinary} fragment from an XMLStreamReader. */ 134 public static XmlHexBinary parse(javax.xml.stream.XMLStreamReader xsr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException{ 135 return (XmlHexBinary) XmlBeans.getContextTypeLoader().parse( xsr, type, options ); } 136 137 /** Returns a validating XMLInputStream. 138 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 139 */ 140 public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 141 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } 142 143 /** Returns a validating XMLInputStream. 144 * @deprecated XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. 145 */ 146 public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { 147 return XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } 148 149 private Factory() { } // No instance of this class allowed 150 } 151 } 152