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)  StringBuffer data
           
(package private)  List 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, os, stream
 
Constructor Summary
CompoundDocument(BufferedInputStream bis)
           
 
Method Summary
 StringBuffer getAllData()
           
 StringBuffer getAllData(String binaryFileList, String firstFile)
           
 void getAllData(String prefix, String binaryFileList, 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.
 List getDirectory()
           
 String getDirectoryListing(String separator)
           
private  void getDirectoryTable()
           
private  StringBuffer getFileAsString(CompoundDocument.CmpDocDirectoryEntry thisEntry, boolean asBinaryString)
           
 StringBuffer getFileAsString(String entryName)
           
private  long getOffset(int SID)
           
private  void getSectorAllocationTable()
           
private  int getSectorData(StringBuffer data, byte[] byteBuf, int nSectorBytes, int nBytes, boolean asBinaryString)
           
private  void getShortSectorAllocationTable()
           
private  StringBuffer getShortStringData(int shortSID, int nBytes, boolean asBinaryString)
           
private  StringBuffer getStandardStringData(int thisSID, int nBytes, boolean asBinaryString)
           
private  void gotoSector(int SID)
           
static boolean isCompoundDocument(byte[] bytes)
           
static boolean isCompoundDocument(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, setIsBigEndian, setOutputStream, setRandom, setStream, setStream, swapBytes, swapBytes
 
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

List 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

StringBuffer data
Constructor Detail

CompoundDocument

public CompoundDocument(BufferedInputStream bis)
Method Detail

isCompoundDocument

public static boolean isCompoundDocument(InputStream is)
                                  throws Exception
Throws:
Exception

isCompoundDocument

public static boolean isCompoundDocument(byte[] bytes)

getDirectory

public List getDirectory()

getDirectoryListing

public String getDirectoryListing(String separator)

getAllData

public StringBuffer getAllData()

getAllData

public void getAllData(String prefix,
                       String binaryFileList,
                       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 StringBuffer getAllData(String binaryFileList,
                               String firstFile)

getFileAsString

public StringBuffer getFileAsString(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 StringBuffer getFileAsString(CompoundDocument.CmpDocDirectoryEntry thisEntry,
                                     boolean asBinaryString)

getStandardStringData

private StringBuffer getStandardStringData(int thisSID,
                                           int nBytes,
                                           boolean asBinaryString)

getSectorData

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

getShortStringData

private StringBuffer getShortStringData(int shortSID,
                                        int nBytes,
                                        boolean asBinaryString)