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; 25 26 import java.io.OutputStream; 27 import java.io.InputStream; 28 import java.io.IOException; 29 30 /** 31 * <p>A <code>Document</code> represents any <code>Document</code> 32 * to be converted and the resulting <code>Document</code> from any 33 * conversion.</p> 34 * 35 * <p>It is created by the <code>PluginFactory</code> object's {@link 36 * org.openoffice.xmerge.PluginFactory#createOfficeDocument 37 * createOfficeDocument} method or the {@link 38 * org.openoffice.xmerge.PluginFactory#createDeviceDocument 39 * createDeviceDocument} method.</p> 40 * 41 * @author Herbie Ong 42 * @see org.openoffice.xmerge.PluginFactory 43 */ 44 public interface Document { 45 46 /** 47 * <p>Writes out the <code>Document</code> content to the specified 48 * <code>OutputStream</code>.</p> 49 * 50 * <p>This method may not be thread-safe. 51 * Implementations may or may not synchronize this 52 * method. User code (i.e. caller) must make sure that 53 * calls to this method are thread-safe.</p> 54 * 55 * @param os <code>OutputStream</code> to write out the 56 * <code>Document</code> content. 57 * 58 * @throws IOException If any I/O error occurs. 59 */ write(OutputStream os)60 public void write(OutputStream os) throws IOException; 61 62 63 /** 64 * <p>Reads the content from the <code>InputStream</code> into 65 * the <code>Document</code>.</p> 66 * 67 * <p>This method may not be thread-safe. 68 * Implementations may or may not synchronize this 69 * method. User code (i.e. caller) must make sure that 70 * calls to this method are thread-safe.</p> 71 * 72 * @param is <code>InputStream</code> to read in the 73 * <code>Document</code> content. 74 * 75 * @throws IOException If any I/O error occurs. 76 */ read(InputStream is)77 public void read(InputStream is) throws IOException; 78 79 80 /** 81 * Returns the <code>Document</code> name with no file extension. 82 * 83 * @return The <code>Document</code> name with no file extension. 84 */ getName()85 public String getName(); 86 87 88 /** 89 * Returns the <code>Document</code> name with file extension. 90 * 91 * @return The <code>Document</code> name with file extension. 92 */ getFileName()93 public String getFileName(); 94 } 95 96