|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwriter2latex.xmerge.OfficeZip
class OfficeZip
Class used by OfficeDocument to handle reading and writing
from a ZIP file, as well as storing ZIP entries.
| Nested Class Summary | |
|---|---|
private class |
OfficeZip.Entry
This inner class is used as a data structure for holding a ZipEntry info and its corresponding bytes. |
| Field Summary | |
|---|---|
private static int |
BUFFERSIZE
|
private int |
contentIndex
|
private static java.lang.String |
CONTENTXML
File name of the XML file in a zipped document. |
private java.util.List<OfficeZip.Entry> |
entryList
|
private int |
manifestIndex
|
private static java.lang.String |
MANIFESTXML
|
private int |
metaIndex
|
private static java.lang.String |
METAXML
|
private int |
settingsIndex
|
private static java.lang.String |
SETTINGSXML
|
private int |
styleIndex
|
private static java.lang.String |
STYLEXML
|
| Constructor Summary | |
|---|---|
OfficeZip()
Default constructor. |
|
| Method Summary | |
|---|---|
private java.util.zip.ZipEntry |
createZipEntry(java.lang.String name,
byte[] bytes,
int method)
Creates a ZipEntry object based on the given params. |
(package private) byte[] |
getContentXMLBytes()
This method returns the CONTENTXML file in a byte array. |
private byte[] |
getEntryBytes(int index)
Used by the getContentXMLBytes method and the
getStyleXMLBytes method to return the
byte array from the corresponding
entry in the entryList. |
(package private) byte[] |
getManifestXMLBytes()
This method returns the MANIFESTXML file in a byte array. |
(package private) byte[] |
getMetaXMLBytes()
This method returns the METAXML file in a byte array. |
(package private) byte[] |
getNamedBytes(java.lang.String name)
This method returns the bytes corresponding to the entry named in the parameter. |
(package private) byte[] |
getSettingsXMLBytes()
This method returns the SETTINGSXML file in a byte array. |
(package private) byte[] |
getStyleXMLBytes()
This method returns the STYLEXML file in a byte array. |
(package private) void |
read(java.io.InputStream is)
Read each zip entry in the InputStream object
and store in entryList both the ZipEntry object
as well as the bits of each entry. |
(package private) void |
setContentXMLBytes(byte[] bytes)
Set or replace the byte array for the
CONTENTXML file. |
private int |
setEntryBytes(int index,
byte[] bytes,
java.lang.String name)
Used by the setContentXMLBytes method and
the setStyleXMLBytes to either replace an
existing Entry, or create a new entry in
entryList. |
(package private) void |
setManifestXMLBytes(byte[] bytes)
Set or replace the byte array for the MANIFESTXML file. |
(package private) void |
setMetaXMLBytes(byte[] bytes)
Set or replace the byte array for the
METAXML file. |
(package private) void |
setNamedBytes(java.lang.String name,
byte[] bytes)
This method sets the bytes for the named entry. |
(package private) void |
setSettingsXMLBytes(byte[] bytes)
Set or replace the byte array for the
SETTINGSXML file. |
(package private) void |
setStyleXMLBytes(byte[] bytes)
Set or replace the byte array for the
STYLEXML file. |
(package private) void |
write(java.io.OutputStream os)
Write out the ZIP entries into the OutputStream
object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String CONTENTXML
private static final java.lang.String STYLEXML
private static final java.lang.String METAXML
private static final java.lang.String SETTINGSXML
private static final java.lang.String MANIFESTXML
private static final int BUFFERSIZE
private java.util.List<OfficeZip.Entry> entryList
private int contentIndex
private int styleIndex
private int metaIndex
private int settingsIndex
private int manifestIndex
| Constructor Detail |
|---|
OfficeZip()
| Method Detail |
|---|
void read(java.io.InputStream is)
throws java.io.IOException
Read each zip entry in the InputStream object
and store in entryList both the ZipEntry object
as well as the bits of each entry. Call this method before
calling the getContentXMLBytes method or the
getStyleXMLBytes method.
Keep track of the CONTENTXML and STYLEXML using contentIndex and styleIndex, respectively.
is - InputStream object to read.
java.io.IOException - If any I/O error occurs.byte[] getContentXMLBytes()
byte array. It returns null if there is no
CONTENTXML in this zip file.
byte array.byte[] getStyleXMLBytes()
byte array. It returns null if there is
no STYLEXML in this zip file.
byte array.byte[] getMetaXMLBytes()
byte array. It returns null if there is
no METAXML in this zip file.
byte array.byte[] getSettingsXMLBytes()
byte array. It returns null if there is
no SETTINGSXML in this zip file.
byte array.byte[] getManifestXMLBytes()
byte array.
It returns null if there is no MANIFESTXML in this zip file.
byte array.byte[] getNamedBytes(java.lang.String name)
name - The name of the entry in the Zip file to retrieve.
byte array or
null if no entry is found.
void setNamedBytes(java.lang.String name,
byte[] bytes)
name - The name of the entry to search for.bytes - The new data to write.private byte[] getEntryBytes(int index)
getContentXMLBytes method and the
getStyleXMLBytes method to return the
byte array from the corresponding
entry in the entryList.
index - Index of Entry object in
entryList.
byte array associated in that
Entry object or null, if there is
not such Entry.void setContentXMLBytes(byte[] bytes)
byte array for the
CONTENTXML file.
bytes - byte array for the
CONTENTXML file.void setStyleXMLBytes(byte[] bytes)
byte array for the
STYLEXML file.
bytes - byte array for the
STYLEXML file.void setMetaXMLBytes(byte[] bytes)
byte array for the
METAXML file.
bytes - byte array for the
METAXML file.void setSettingsXMLBytes(byte[] bytes)
byte array for the
SETTINGSXML file.
bytes - byte array for the
SETTINGSXML file.void setManifestXMLBytes(byte[] bytes)
byte array for the MANIFESTXML file.
bytes - byte array for the MANIFESTXML file.
private int setEntryBytes(int index,
byte[] bytes,
java.lang.String name)
Used by the setContentXMLBytes method and
the setStyleXMLBytes to either replace an
existing Entry, or create a new entry in
entryList.
If there is an Entry object within
entryList that corresponds to the index, replace the
ZipEntry info.
index - Index of Entry to modify.bytes - Entry value.name - Name of Entry.
void write(java.io.OutputStream os)
throws java.io.IOException
OutputStream
object.
os - OutputStream object to write ZIP.
java.io.IOException - If any ZIP I/O error occurs.
private java.util.zip.ZipEntry createZipEntry(java.lang.String name,
byte[] bytes,
int method)
ZipEntry object based on the given params.
name - Name for the ZipEntry.bytes - byte array for ZipEntry.method - ZIP method to be used for ZipEntry.
ZipEntry object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||