code: public List<ArchiveRecordHeader> validate(int numRecords) 
      throws IOException {
          List<ArchiveRecordHeader> hdrList = new ArrayList<ArchiveRecordHeader>();
          int recordCount = 0;
          setStrict(true);
          for (Iterator<ArchiveRecord> i = iterator(); i.hasNext();) {
              recordCount++;
              ArchiveRecord r = i.next();
              if (r.getHeader().getLength() <= 0
                  && r.getHeader().getMimetype().
                      equals(MimetypeUtils.NO_TYPE_MIMETYPE)) {
                  throw new IOException("record content is empty.");
              }
              r.close();
              hdrList.add(r.getHeader());
          }
  
          if (numRecords != -1) {
              if (recordCount != numRecords) {
                  throw new IOException("Count of records, " 
                          + Integer.toString(recordCount) 
                          + " is not equal to expected " 
                          + Integer.toString(numRecords));
              }
          }
  
          return hdrList;
      }
docs: Validate the Archive file.
  
  This method iterates over the file throwing exception if it fails
  to successfully parse.
  
  <p>We start validation from wherever we are in the stream.
  
  @param numRecords Number of records expected.  Pass -1 if number is
  unknown.
  
  @return List of all read metadatas. As we validate records, we add
  a reference to the read metadata.
  
  @throws IOException