1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge.converter.xml.sxw; 25 26 import java.io.InputStream; 27 import java.io.IOException; 28 29 import org.openoffice.xmerge.PluginFactory; 30 import org.openoffice.xmerge.Document; 31 import org.openoffice.xmerge.util.registry.ConverterInfo; 32 33 /** 34 * General implementation of the <code>PluginFactory</code> interface 35 * for SXW documents. 36 * 37 * @see org.openoffice.xmerge.DocumentDeserializer 38 * @see org.openoffice.xmerge.DocumentMerger 39 * @see org.openoffice.xmerge.DocumentSerializer 40 */ 41 public abstract class SxwPluginFactory extends PluginFactory { 42 43 /** 44 * Constructor that caches the <code>ConvertInfo</code> that 45 * corresponds to the registry information for this plug-in. 46 * 47 * @param ci <code>ConvertInfo</code> object. 48 */ SxwPluginFactory(ConverterInfo ci)49 public SxwPluginFactory (ConverterInfo ci) { 50 super(ci); 51 } 52 53 createOfficeDocument(String name, InputStream is)54 public Document createOfficeDocument(String name, InputStream is) 55 throws IOException { 56 57 // read zipped XML stream 58 SxwDocument doc = new SxwDocument(name); 59 doc.read(is); 60 return doc; 61 } 62 createOfficeDocument(String name, InputStream is,boolean isZip)63 public Document createOfficeDocument(String name, InputStream is,boolean isZip) 64 throws IOException { 65 66 // read XML stream 67 SxwDocument doc = new SxwDocument(name); 68 doc.read(is,isZip); 69 return doc; 70 } 71 } 72 73