code: public List<Certificate> getCertificates() throws CertificateException, IOException {
          final String methodName = "getCertificates";
          logger.entry(this, methodName);
          
          final String fileData = getPemFileData();
  
          final List<ByteBuf> certDataList = new ArrayList<ByteBuf>();
          final Matcher m = CERTIFICATE_PATTERN.matcher(fileData);
          int start = 0;
          while (m.find(start)) {            
              final ByteBuf base64CertData = Unpooled.copiedBuffer(m.group(1), Charset.forName("US-ASCII"));
              final ByteBuf certData = Base64.decode(base64CertData);
              base64CertData.release();
              certDataList.add(certData);
              start = m.end();
          }
          
          if (certDataList.isEmpty()) {
              final CertificateException exception = new CertificateException("No certificates found in PEM file: " + pemFile);
              logger.throwing(this,  methodName, exception);
              throw exception;
          }
          
          final CertificateFactory cf = CertificateFactory.getInstance("X.509");
          final List<Certificate> certificates = new ArrayList<Certificate>();
  
          try {
              for (ByteBuf certData: certDataList) {
                  certificates.add(cf.generateCertificate(new ByteBufInputStream(certData)));
              }
          } finally {
              for (ByteBuf certData: certDataList) certData.release();
          }
          
          logger.exit(this, methodName, certificates);
          
          return certificates;
      }
docs: Obtains the list of certificates stored in the PEM file.
  
  @return The list of certificates stored in the PEM file.
  @throws CertificateException If a parsing error occurs.
  @throws IOException If the PEM file cannot be read for any reason.