/************************************************************************ * * BinaryGraphicsDocument.java * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * Copyright: 2002-2010 by Henrik Just * * All Rights Reserved. * * Version 1.2 (2010-03-28) * */ package writer2latex.xmerge; import java.io.OutputStream; import java.io.InputStream; //import java.io.ByteArrayOutputStream; import java.io.IOException; import writer2latex.util.Misc; /** *
Class representing a binary graphics document. * This class is used for representing graphics documents that are not * interpreted in any way, but simply copied verbatim from the source format * to the target format.
* *GraphicsDocument
is used to create new graphics documents.
Constructs a new graphics document.
* *This new document does not contain any information. Document data must
* either be added using appropriate methods, or an existing file can be
* {@link #read(InputStream) read} from an InputStream
.
GraphicsDocument
.
*/
public BinaryGraphicsDocument(String name, String sFileExtension, String sMimeType) {
this.sFileExtension = sFileExtension;
this.sMimeType = sMimeType;
docName = trimDocumentName(name);
}
/**
* This method reads byte
data from the InputStream.
Returns the Document
name with no file extension.
Document
name with no file extension.
*/
public String getName() {
return docName;
}
/**
* Returns the Document
name with file extension.
Document
name with file extension.
*/
public String getFileName() {
return new String(docName + getFileExtension());
}
/**
* Writes out the Document
content to the specified
* OutputStream
.
This method may not be thread-safe. * Implementations may or may not synchronize this * method. User code (i.e. caller) must make sure that * calls to this method are thread-safe.
* * @param osOutputStream
to write out the
* Document
content.
*
* @throws IOException If any I/O error occurs.
*/
public void write(OutputStream os) throws IOException {
os.write(data, nOff, nLen);
}
/**
* Returns the file extension for this type of
* Document
.
*
* @return The file extension of Document
.
*/
public String getFileExtension(){ return sFileExtension; }
/**
* Method to return the MIME type of the document.
*
* @return String The document's MIME type.
*/
public String getDocumentMIMEType(){ return sMimeType; }
public String getMIMEType() {
return sMimeType;
}
public boolean isMasterDocument() {
return false;
}
}