org.jmol.util
Class CompoundDocument

java.lang.Object
  extended by org.jmol.util.BinaryDocument
      extended by org.jmol.util.CompoundDocument

public class CompoundDocument
extends BinaryDocument


Nested Class Summary
(package private)  class CompoundDocument.CmpDocDirectoryEntry
           
(package private)  class CompoundDocument.CmpDocHeader
           
 
Field Summary
(package private)  java.lang.StringBuffer data
           
(package private)  java.util.Vector directory
           
(package private)  CompoundDocument.CmpDocHeader header
           
(package private)  int nDirEntriesperSector
           
(package private)  int nIntPerSector
           
(package private)  int nShortSectorsPerStandardSector
           
(package private)  CompoundDocument.CmpDocDirectoryEntry rootEntry
           
(package private)  int[] SAT
           
(package private)  int sectorSize
           
(package private)  int shortSectorSize
           
(package private)  int[] SSAT
           
 
Fields inherited from class org.jmol.util.BinaryDocument
isBigEndian, isRandom, nBytes, stream
 
Constructor Summary
CompoundDocument(java.io.BufferedInputStream bis)
           
 
Method Summary
 java.lang.StringBuffer getAllData()
           
 java.lang.StringBuffer getAllData(java.lang.String binaryFileList)
           
 void getAllData(java.lang.String prefix, java.lang.String binaryFileList, java.util.Hashtable fileData)
          reads a compound document directory and saves all data in a Hashtable so that the files may be organized later in a different order.
 java.util.Vector getDirectory()
           
 java.lang.String getDirectoryListing(java.lang.String separator)
           
private  void getDirectoryTable()
           
private  java.lang.StringBuffer getFileAsString(CompoundDocument.CmpDocDirectoryEntry thisEntry, boolean asBinaryString)
           
 java.lang.StringBuffer getFileAsString(java.lang.String entryName)
           
private  long getOffset(int SID)
           
private  void getSectorAllocationTable()
           
private  int getSectorData(java.lang.StringBuffer data, byte[] byteBuf, int nSectorBytes, int nBytes, boolean asBinaryString)
           
private  void getShortSectorAllocationTable()
           
private  java.lang.StringBuffer getShortStringData(int shortSID, int nBytes, boolean asBinaryString)
           
private  java.lang.StringBuffer getStandardStringData(int thisSID, int nBytes, boolean asBinaryString)
           
private  void gotoSector(int SID)
           
static boolean isCompoundDocument(byte[] bytes)
           
static boolean isCompoundDocument(java.io.InputStream is)
           
private  boolean readHeader()
           
 
Methods inherited from class org.jmol.util.BinaryDocument
close, getPosition, readByte, readByteArray, readByteArray, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, seek, setRandom, setStream, setStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

header

CompoundDocument.CmpDocHeader header

directory

java.util.Vector directory

rootEntry

CompoundDocument.CmpDocDirectoryEntry rootEntry

SAT

int[] SAT

SSAT

int[] SSAT

sectorSize

int sectorSize

shortSectorSize

int shortSectorSize

nShortSectorsPerStandardSector

int nShortSectorsPerStandardSector

nIntPerSector

int nIntPerSector

nDirEntriesperSector

int nDirEntriesperSector

data

java.lang.StringBuffer data
Constructor Detail

CompoundDocument

public CompoundDocument(java.io.BufferedInputStream bis)
Method Detail

isCompoundDocument

public static boolean isCompoundDocument(java.io.InputStream is)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

isCompoundDocument

public static boolean isCompoundDocument(byte[] bytes)

getDirectory

public java.util.Vector getDirectory()

getDirectoryListing

public java.lang.String getDirectoryListing(java.lang.String separator)

getAllData

public java.lang.StringBuffer getAllData()

getAllData

public void getAllData(java.lang.String prefix,
                       java.lang.String binaryFileList,
                       java.util.Hashtable fileData)
reads a compound document directory and saves all data in a Hashtable so that the files may be organized later in a different order. Also adds a #Directory_Listing entry. Files are bracketed by BEGIN Directory Entry and END Directory Entry lines, similar to ZipUtil.getAllData.

Parameters:
prefix -
binaryFileList - |-separated list of files that should be saved as xx xx xx hex byte strings. The directory listing is appended with ":asBinaryString"
fileData -

getAllData

public java.lang.StringBuffer getAllData(java.lang.String binaryFileList)

getFileAsString

public java.lang.StringBuffer getFileAsString(java.lang.String entryName)

getOffset

private long getOffset(int SID)

gotoSector

private void gotoSector(int SID)

readHeader

private boolean readHeader()

getSectorAllocationTable

private void getSectorAllocationTable()

getShortSectorAllocationTable

private void getShortSectorAllocationTable()

getDirectoryTable

private void getDirectoryTable()

getFileAsString

private java.lang.StringBuffer getFileAsString(CompoundDocument.CmpDocDirectoryEntry thisEntry,
                                               boolean asBinaryString)

getStandardStringData

private java.lang.StringBuffer getStandardStringData(int thisSID,
                                                     int nBytes,
                                                     boolean asBinaryString)

getSectorData

private int getSectorData(java.lang.StringBuffer data,
                          byte[] byteBuf,
                          int nSectorBytes,
                          int nBytes,
                          boolean asBinaryString)
                   throws java.lang.Exception
Throws:
java.lang.Exception

getShortStringData

private java.lang.StringBuffer getShortStringData(int shortSID,
                                                  int nBytes,
                                                  boolean asBinaryString)