/** * This constructor loads a Word document from a specific point * in a POIFSFileSystem, probably not the default. * Used typically to open embeded documents. * * @param directory The DirectoryNode that contains the Word document. * @throws IOException If there is an unexpected IOException from the passed * in POIFSFileSystem. */ public HWPFDocumentCore(DirectoryNode directory) throws IOException { // Sort out the hpsf properties super(directory); // read in the main stream. _mainStream = getDocumentEntryBytes(STREAM_WORD_DOCUMENT, FIB_BASE_LEN, Integer.MAX_VALUE); _fib = new FileInformationBlock(_mainStream); DirectoryEntry objectPoolEntry = null; if (directory.hasEntry(STREAM_OBJECT_POOL)) { objectPoolEntry = (DirectoryEntry) directory.getEntry(STREAM_OBJECT_POOL); } _objectPool = new ObjectPoolImpl(objectPoolEntry); } /**
fibBase = _fib.getFibBase(); } else { byte[] fibBaseBytes = (_mainStream != null) ? _mainStream : getDocumentEntryBytes(STREAM_WORD_DOCUMENT, -1, FIB_BASE_LEN); fibBase = new FibBase( fibBaseBytes, 0 ); byte[] tableStream = getDocumentEntryBytes(tableStrmName, -1, fibBase.getLKey()); LittleEndianByteArrayInputStream leis = new LittleEndianByteArrayInputStream(tableStream); EncryptionMode em = fibBase.isFObfuscated() ? EncryptionMode.xor : null;