svgutility.java

来自「java开源的企业总线.xmlBlaster」· Java 代码 · 共 61 行

JAVA
61
字号
/*------------------------------------------------------------------------------Name:      SvgUtility.javaProject:   xmlBlaster.orgCopyright: xmlBlaster.org, see xmlBlaster-LICENSE fileComment:   Demo code for a svg client using batikVersion:   $Id: SvgUtility.java 16476 2007-09-06 22:36:52Z laghi $------------------------------------------------------------------------------*/package javaclients.svg.batik;import java.io.IOException;import java.io.Reader;import java.io.InputStream;import java.io.ByteArrayInputStream;import java.io.StringReader;import org.apache.batik.dom.svg.SAXSVGDocumentFactory;import org.apache.batik.dom.svg.SVGOMDocument;/** * @author $Author: laghi $ (michele@laghi.eu) */public class SvgUtility{   private final static String PARSER_CLASSNAME = "org.apache.crimson.parser.XMLReaderImpl";   protected SvgUtility ()   {   }   public static SVGOMDocument createDocument (Reader reader, String dummyURI)      throws IOException   {      SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(PARSER_CLASSNAME);      return (org.apache.batik.dom.svg.SVGOMDocument)factory.createDocument(dummyURI, reader);   }   public static SVGOMDocument createDocument (InputStream inputStream, String dummyURI)      throws IOException   {      SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(PARSER_CLASSNAME);      return (org.apache.batik.dom.svg.SVGOMDocument)factory.createDocument(dummyURI, inputStream);   }   public static SVGOMDocument createDocument (String xmlString, String dummyURI) throws IOException   {      return createDocument(new StringReader(xmlString), dummyURI);   }   public static SVGOMDocument createDocument (byte[] byteArray, String dummyURI) throws IOException   {      return createDocument(new ByteArrayInputStream(byteArray), dummyURI);   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?