FileDocCategorySizeDatePackage
HWPFDocFixture.javaAPI DocApache Poi 3.0.12559Mon Jan 01 18:55:40 GMT 2007org.apache.poi.hwpf

HWPFDocFixture

public class HWPFDocFixture extends Object

Fields Summary
public byte[]
_tableStream
public byte[]
_mainStream
public FileInformationBlock
_fib
Constructors Summary
public HWPFDocFixture(Object obj)


  
Methods Summary
public voidsetUp()

    try
    {
      String filename = System.getProperty("HWPF.testdata.path");
      if (filename == null)
      {
        filename = "c:";
      }

      filename = filename + "/test.doc";


      POIFSFileSystem filesystem = new POIFSFileSystem(new FileInputStream(
        new File(filename)));

      DocumentEntry documentProps =
        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
      _mainStream = new byte[documentProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

      // use the fib to determine the name of the table stream.
      _fib = new FileInformationBlock(_mainStream);

      String name = "0Table";
      if (_fib.isFWhichTblStm())
      {
        name = "1Table";
      }

      // read in the table stream.
      DocumentEntry tableProps =
        (DocumentEntry) filesystem.getRoot().getEntry(name);
      _tableStream = new byte[tableProps.getSize()];
      filesystem.createDocumentInputStream(name).read(_tableStream);

      _fib.fillVariableFields(_mainStream, _tableStream);
    }
    catch (Throwable t)
    {
      t.printStackTrace();
    }
  
public voidtearDown()