Interface KeyPairResourceParser

    • Field Detail

      • EMPTY

        static final KeyPairResourceParser EMPTY
        An empty parser that never fails, but always report that it cannot extract key pairs and returns empty list if asked to load
    • Method Detail

      • canExtractKeyPairs

        boolean canExtractKeyPairs​(NamedResource resourceKey,
                                   java.util.List<java.lang.String> lines)
                            throws java.io.IOException,
                                   java.security.GeneralSecurityException
        Parameters:
        resourceKey - A hint as to the origin of the text lines
        lines - The resource lines
        Returns:
        true if the parser can extract some key pairs from the lines
        Throws:
        java.io.IOException - If failed to process the lines
        java.security.GeneralSecurityException - If failed to extract information regarding the possibility to extract the key pairs
      • extractDataBytes

        static byte[] extractDataBytes​(java.util.Collection<java.lang.String> lines)
        Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.
        Parameters:
        lines - The data lines - empty lines and spaces are automatically deleted before BASE-64 decoding takes place.
        Returns:
        The decoded data bytes
        See Also:
        joinDataLines(Collection)
      • joinDataLines

        static java.lang.String joinDataLines​(java.util.Collection<java.lang.String> lines)
      • containsMarkerLine

        static boolean containsMarkerLine​(java.util.List<java.lang.String> lines,
                                          java.lang.String marker)
      • containsMarkerLine

        static boolean containsMarkerLine​(java.util.List<java.lang.String> lines,
                                          java.util.List<java.lang.String> markers)
      • findMarkerLine

        static java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,​java.lang.Integer> findMarkerLine​(java.util.List<java.lang.String> lines,
                                                                                                                    java.util.List<java.lang.String> markers)
        Attempts to locate a line that contains one of the markers
        Parameters:
        lines - The list of lines to scan - ignored if null/empty
        markers - The markers to match - ignored if null/empty
        Returns:
        A AbstractMap.SimpleImmutableEntry whose key is the first line index that matched and value the matched marker index - null if no match found
        See Also:
        findMarkerLine(List, int, List)
      • findMarkerLine

        static java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,​java.lang.Integer> findMarkerLine​(java.util.List<java.lang.String> lines,
                                                                                                                    int startLine,
                                                                                                                    java.util.List<java.lang.String> markers)
        Attempts to locate a line that contains one of the markers
        Parameters:
        lines - The list of lines to scan - ignored if null/empty
        startLine - The scan start line index
        markers - The markers to match - ignored if null/empty
        Returns:
        A AbstractMap.SimpleImmutableEntry whose key is the first line index that matched and value the matched marker index - null if no match found