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 TypeMethodDescriptionbyte[]
getData()
Get the data of the imageGet the document name or URLGet the MIME type of the document.boolean
Is this image in an acceptable format for the converter?boolean
isLinked()
Does thisBinaryGraphicsDocument
represent a linked image?boolean
Is this document a master document?boolean
Is this graphics document recycled?void
setData
(byte[] data, boolean bIsAcceptedFormat) Set image contents to a byte arrayvoid
setData
(byte[] data, int nOff, int nLen, boolean bIsAcceptedFormat) Set image contents to part of a byte arrayvoid
write
(OutputStream os) Writes out the content to the specifiedOutputStream
.
-
Constructor Details
-
BinaryGraphicsDocument
Constructs a new graphics document. Until data is added using theread
methods, 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 thisBinaryGraphicsDocument
represent 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:
write
in interfaceOutputFile
- Parameters:
os
-OutputStream
to write out the content.- Throws:
IOException
- If any I/O error occurs.
-
getFileName
Get the document name or URL- Specified by:
getFileName
in interfaceOutputFile
- Returns:
- The document name or URL
-
getMIMEType
Get the MIME type of the document.- Specified by:
getMIMEType
in interfaceOutputFile
- Returns:
- The MIME type or null if this is unknown
-
isMasterDocument
public boolean isMasterDocument()Is this document a master document?- Specified by:
isMasterDocument
in interfaceOutputFile
- Returns:
- false - a graphics file is never a master document
-