Package writer2latex.base
Class BinaryGraphicsDocument
java.lang.Object
writer2latex.base.BinaryGraphicsDocument
- All Implemented Interfaces:
OutputFile
This class is used to represent a binary graphics document to be included in the converter result.
I may also represent a linked image, which should not be included (and will produce an empty file
if it is).
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryGraphicsDocument(String sFileName, String sMimeType) Constructs a new graphics document.Construct a new graphics document which is a recycled version of the supplied one. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes this document contain formulas?byte[]getData()Get the data of the imageGet the document name or URLGet the MIME type of the document.booleanIs this image in an acceptable format for the converter?booleanisLinked()Does thisBinaryGraphicsDocumentrepresent a linked image?booleanIs this document a master document?booleanIs this graphics document recycled?voidsetData(byte[] data, boolean bIsAcceptedFormat) Set image contents to a byte arrayvoidsetData(byte[] data, int nOff, int nLen, boolean bIsAcceptedFormat) Set image contents to part of a byte arrayvoidwrite(OutputStream os) Writes out the content to the specifiedOutputStream.
-
Constructor Details
-
BinaryGraphicsDocument
Constructs a new graphics document. Until data is added using thereadmethods, the document is considered a link to the image given by the file name.- Parameters:
sFileName- The name or URL of theGraphicsDocument.sMimeType- the MIME type of the document
-
BinaryGraphicsDocument
Construct a new graphics document which is a recycled version of the supplied one. This implies that all information is identical, but the recycled version does not contain any data. This is for images that are used more than once in the document.- Parameters:
bgd- the source document
-
-
Method Details
-
isRecycled
public boolean isRecycled()Is this graphics document recycled?- Returns:
- true if this is the case
-
setData
public void setData(byte[] data, boolean bIsAcceptedFormat) Set image contents to a byte array- Parameters:
data- the image databIsAcceptedFormat- flag to indicate that the format of the image is acceptable for the converter
-
setData
public void setData(byte[] data, int nOff, int nLen, boolean bIsAcceptedFormat) Set image contents to part of a byte array- Parameters:
data- the image datanOff- the offset into the byte arraynLen- the number of bytes to usebIsAcceptedFormat- flag to indicate that the format of the image is acceptable for the converter
-
isLinked
public boolean isLinked()Does thisBinaryGraphicsDocumentrepresent a linked image?- Returns:
- true if so
-
isAcceptedFormat
public boolean isAcceptedFormat()Is this image in an acceptable format for the converter?- Returns:
- true if so (always returns false for linked images)
-
getData
public byte[] getData()Get the data of the image- Returns:
- the image data as a byte array - or null if this is a linked image
-
write
Writes out the content to the specifiedOutputStream. Linked images will not write any data.- Specified by:
writein interfaceOutputFile- Parameters:
os-OutputStreamto write out the content.- Throws:
IOException- If any I/O error occurs.
-
getFileName
Get the document name or URL- Specified by:
getFileNamein interfaceOutputFile- Returns:
- The document name or URL
-
getMIMEType
Get the MIME type of the document.- Specified by:
getMIMETypein interfaceOutputFile- Returns:
- The MIME type or null if this is unknown
-
isMasterDocument
public boolean isMasterDocument()Is this document a master document?- Specified by:
isMasterDocumentin interfaceOutputFile- Returns:
- false - a graphics file is never a master document
-
containsMath
public boolean containsMath()Does this document contain formulas?- Specified by:
containsMathin interfaceOutputFile- Returns:
- false - a graphics file does not contain formulas
-