Package org.bzdev.net

Class PemDecoder

java.lang.Object
org.bzdev.net.PemDecoder

public class PemDecoder extends Object
PEM Decoder. This decoder will decode PEM-encoded data and additionally will provide the type of the data and any headers that may precede the PEM-encoded data.

PEM encoding is defined in RFC 7468 and related RFCs.

  • Constructor Details

    • PemDecoder

      public PemDecoder()
  • Method Details

    • decode

      public static PemDecoder.Result decode(Reader r) throws IOException
      Decode headers and PEM-encoded data from a Reader. This is a convenience method for the case were a Reader is available, but not an input stream.
      Parameters:
      r - a reader providing optional headers and PEM-encoded data
      Returns:
      a PemDecoder.Result object storing the decoded data
      Throws:
      IOException - if an IO error occurred
    • decode

      public static PemDecoder.Result decode(String string) throws IOException
      Decode headers and PEM-encoded data from a string.
      Parameters:
      string - a string containing optional headers and PEM-encoded data
      Returns:
      a PemDecoder.Result object storing the decoded data
      Throws:
      IOException - if an IO error occurred
    • decode

      public static PemDecoder.Result decode(InputStream is) throws IOException
      Decode headers and PEM-encoded data from an input stream.
      Parameters:
      is - an input stream containing optional headers and PEM-encoded data
      Returns:
      a PemDecoder.Result object storing the decoded data
      Throws:
      IOException - if an IO error occurred