code: private void decodePublicationsFile(TLVInputStream input) throws KSIException, IOException {
          while (input.hasNextElement()) {
              TLVElement element = input.readElement();
              switch (element.getType()) {
                  case PublicationsFileHeader.ELEMENT_TYPE:
                      if (header != null) {
                          throw new InvalidPublicationsFileException("Publications file contains multiple header components");
                      }
                      this.header = new PublicationsFileHeader(element);
                      break;
                  case InMemoryCertificateRecord.ELEMENT_TYPE:
                      certificateRecords.add(new InMemoryCertificateRecord(element));
                      break;
                  case PublicationsFilePublicationRecord.ELEMENT_TYPE:
                      publicationRecords.add(new PublicationsFilePublicationRecord(element));
                      break;
                  case ELEMENT_TYPE_CMS_SIGNATURE:
                      cmsSignature = element.getContent();
                      break;
                  default:
                      throw new InvalidPublicationsFileException("Invalid publications file element type=0x" + Integer.toHexString(element.getType()));
              }
              verifyElementOrder(element);
              elements.add(element);
          }
      }
docs: Decodes publications file. Reads publications data from given input stream.
  
  @param input
  input stream to createSignature. not null.
  @throws InvalidPublicationsFileException
  @throws IOException