📄 mobilesunmarshaller.java
字号:
/** * This class was generated from a set of XML constraints * by the Enhydra Zeus XML Data Binding Framework. All * source code in this file is constructed specifically * to work with other Zeus-generated classes. If you * modify this file by hand, you run the risk of breaking * this interoperation, as well as introducing errors in * source code compilation. * * * * * * MODIFY THIS FILE AT YOUR OWN RISK * * * * * * * To find out more about the Enhydra Zeus framework, you * can point your browser at <http://zeus.enhydra.org> * where you can download releases, join and discuss Zeus * on user and developer mailing lists, and access source * code. Please report any bugs through that website. */package edu.tsinghua.lumaqq.xml.mobiles;// Global Unmarshaller Import Statementsimport java.io.*;import org.xml.sax.EntityResolver;import org.xml.sax.ErrorHandler;import org.xml.sax.SAXException;import org.xml.sax.SAXParseException;public class MobilesUnmarshaller { /** The EntityResolver for parser resolution. */ private static EntityResolver entityResolver; /** The ErrorHandler for parser resolution. */ private static ErrorHandler errorHandler; /** * <p> * This sets a SAX <code>EntityResolver</code> for this unmarshalling process. * </p> * * @param resolver the entity resolver to use. */ public static void setEntityResolver(EntityResolver resolver) { entityResolver = resolver; } /** * <p> * This sets a SAX <code>ErrorHandler</code> for this unmarshalling process. * </p> * * @param handler the error handler to use. */ public static void setErrorHandler(ErrorHandler handler) { errorHandler = handler; } public static String getInputEncoding(BufferedReader reader) throws IOException { String inputEncoding = "utf-8"; String aLine = null; while ( (aLine = reader.readLine()) != null ) { aLine = aLine.trim().toLowerCase(); if (aLine.length() == 0) continue; if (!aLine.startsWith("<")) break; aLine = aLine.substring(1).trim(); if (!aLine.startsWith("?")) break; int index = aLine.indexOf("encoding"); if (index == -1) break; aLine = aLine.substring(index+8).trim(); if (!aLine.startsWith("=")) break; aLine = aLine.substring(1).trim(); if (!aLine.startsWith("\"")) break; if (aLine.indexOf("\"", 1) == -1) break; inputEncoding = aLine.substring(1, aLine.indexOf("\"", 1)); break; } reader.close(); return inputEncoding; } public static Mobiles unmarshal(File file) throws IOException { // Delegate to the unmarshal(Reader) method String encoding = getInputEncoding( new BufferedReader(new InputStreamReader(new FileInputStream(file), "ISO-8859-1")) ); return unmarshal(new InputStreamReader(new FileInputStream(file), encoding)); } public static Mobiles unmarshal(File file, boolean validate) throws IOException { // Delegate to the unmarshal(Reader) method String encoding = getInputEncoding( new BufferedReader(new InputStreamReader(new FileInputStream(file), "ISO-8859-1")) ); return unmarshal(new InputStreamReader(new FileInputStream(file), encoding), validate); } public static Mobiles unmarshal(InputStream inputStream) throws IOException { // Delegate to the unmarshal(Reader) method String encoding = getInputEncoding( new BufferedReader(new InputStreamReader(inputStream, "ISO-8859-1")) ); return unmarshal(new InputStreamReader(inputStream, encoding)); } public static Mobiles unmarshal(InputStream inputStream, boolean validate) throws IOException { // Delegate to the unmarshal(Reader) method String encoding = getInputEncoding( new BufferedReader(new InputStreamReader(inputStream, "ISO-8859-1")) ); return unmarshal(new InputStreamReader(inputStream, encoding), validate); } public static Mobiles unmarshal(Reader reader) throws IOException { // See if validation set as system property String property = System.getProperty("org.enhydra.zeus.validation", "false"); boolean validationState = false; if (property.equalsIgnoreCase("true")) { validationState = true; } // Delegate with validation state return unmarshal(reader, validationState); } public static Mobiles unmarshal(Reader reader, boolean validate) throws IOException { // Set the entity resolver, if needed if (entityResolver != null) { MobilesImpl.setEntityResolver(entityResolver); } // Set the error handler, if needed if (errorHandler != null) { MobilesImpl.setErrorHandler(errorHandler); } else { if (validate) { MobilesImpl.setErrorHandler(new MobilesDefaultErrorHandler()); } } // Unmarshal using the implementation class return MobilesImpl.unmarshal(reader, validate); }}class MobilesDefaultErrorHandler implements ErrorHandler { public void warning(SAXParseException e) throws SAXException { System.err.println("Parsing Warning: " + e.getMessage()); } public void error(SAXParseException e) throws SAXException { System.err.println("Parsing Error: " + e.getMessage()); throw e; } public void fatalError(SAXParseException e) throws SAXException { System.err.println("Fatal Parsing Error: " + e.getMessage()); throw e; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -