Пример #1
0
  public void run() throws IOException {
    NPOIFSFileSystem fs = new NPOIFSFileSystem(new File(file), true);
    try {
      InputStream din = BiffViewer.getPOIFSInputStream(fs);
      try {
        RecordInputStream rinp = new RecordInputStream(din);

        while (rinp.hasNextRecord()) {
          int sid = rinp.getNextSid();
          rinp.nextRecord();

          int size = rinp.available();
          Class<? extends Record> clz = RecordFactory.getRecordClass(sid);

          System.out.print(formatSID(sid) + " - " + formatSize(size) + " bytes");
          if (clz != null) {
            System.out.print("  \t");
            System.out.print(clz.getName().replace("org.apache.poi.hssf.record.", ""));
          }
          System.out.println();

          byte[] data = rinp.readRemainder();
          if (data.length > 0) {
            System.out.print("   ");
            System.out.println(formatData(data));
          }
        }
      } finally {
        din.close();
      }
    } finally {
      fs.close();
    }
  }