Package writer2latex.base
Class BinaryGraphicsDocument
- java.lang.Object
-
- writer2latex.base.BinaryGraphicsDocument
-
- All Implemented Interfaces:
OutputFile
public class BinaryGraphicsDocument extends java.lang.Object implements 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
Constructors Constructor Description BinaryGraphicsDocument(java.lang.String sFileName, java.lang.String sMimeType)
Constructs a new graphics document.BinaryGraphicsDocument(BinaryGraphicsDocument bgd)
Construct a new graphics document which is a recycled version of the supplied one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getData()
Get the data of the imagejava.lang.String
getFileName()
Get the document name or URLjava.lang.String
getMIMEType()
Get the MIME type of the document.boolean
isAcceptedFormat()
Is this image in an acceptable format for the converter?boolean
isLinked()
Does thisBinaryGraphicsDocument
represent a linked image?boolean
isMasterDocument()
Is this document a master document?boolean
isRecycled()
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(java.io.OutputStream os)
Writes out the content to the specifiedOutputStream
.
-
-
-
Constructor Detail
-
BinaryGraphicsDocument
public BinaryGraphicsDocument(java.lang.String sFileName, java.lang.String sMimeType)
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
public BinaryGraphicsDocument(BinaryGraphicsDocument bgd)
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 Detail
-
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
public void write(java.io.OutputStream os) throws java.io.IOException
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:
java.io.IOException
- If any I/O error occurs.
-
getFileName
public java.lang.String getFileName()
Get the document name or URL- Specified by:
getFileName
in interfaceOutputFile
- Returns:
- The document name or URL
-
getMIMEType
public java.lang.String 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
-
-