public void testReadWrite() throws Exception { HWPFFileSystem fileSys = new HWPFFileSystem(); HWPFOutputStream tableOut = fileSys.getStream("1Table"); HWPFOutputStream mainOut = fileSys.getStream("WordDocument"); _styleSheet.writeTo(tableOut); byte[] newTableStream = tableOut.toByteArray(); StyleSheet newStyleSheet = new StyleSheet(newTableStream, 0); assertEquals(newStyleSheet, _styleSheet); }
public void testReadWriteFromNonZeroOffset() throws Exception { HWPFFileSystem fileSys = new HWPFFileSystem(); HWPFOutputStream tableOut = fileSys.getStream("1Table"); tableOut.write(new byte[20]); // 20 bytes of whatever at the front. _styleSheet.writeTo(tableOut); byte[] newTableStream = tableOut.toByteArray(); StyleSheet newStyleSheet = new StyleSheet(newTableStream, 20); assertEquals(newStyleSheet, _styleSheet); }