Class BinaryGraphicsDocument
- All Implemented Interfaces:
OutputFile
,Document
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.
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryGraphicsDocument
(String name, String sFileExtension, String sMimeType) Constructs a new graphics document. -
Method Summary
Modifier and TypeMethodDescriptionMethod to return the MIME type of the document.Returns the file extension for this type ofDocument
.Returns theDocument
name with file extension.getName()
Returns theDocument
name with no file extension.void
read
(byte[] data) void
read
(byte[] data, int nOff, int nLen) void
read
(InputStream is) This method readsbyte
data from the InputStream.void
write
(OutputStream os) Writes out theDocument
content to the specifiedOutputStream
.
-
Constructor Details
-
BinaryGraphicsDocument
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
read
from anInputStream
.- Parameters:
name
- The name of theGraphicsDocument
.
-
-
Method Details
-
read
This method reads
byte
data from the InputStream.- Specified by:
read
in interfaceDocument
- Parameters:
is
- InputStream containing a binary data file.- Throws:
IOException
- In case of any I/O errors.
-
read
public void read(byte[] data) -
read
public void read(byte[] data, int nOff, int nLen) -
getName
Returns the
Document
name with no file extension. -
getFileName
Returns the
Document
name with file extension.- Specified by:
getFileName
in interfaceOutputFile
- Returns:
- The
Document
name with file extension.
-
write
Writes out the
Document
content to the specifiedOutputStream
.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.
- Specified by:
write
in interfaceOutputFile
- Parameters:
os
-OutputStream
to write out theDocument
content.- Throws:
IOException
- If any I/O error occurs.
-
getFileExtension
Returns the file extension for this type ofDocument
.- Returns:
- The file extension of
Document
.
-
getDocumentMIMEType
Method to return the MIME type of the document.- Returns:
- String The document's MIME type.
-