Interface Encoder

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] decode​(byte[] toDecode, byte[] salt, byte[] passphrase, String charset)
      Decode bytes (if supported) to text.
      byte[] encode​(byte[] toEncode, byte[] salt, byte[] passphrase, String charset)
      Encode a string
      String getId()
      Get the ID of this encoder.
      boolean isOfType​(byte[] encodedBytes, String charset)
      Determine if this encoder may have been used to create the provided encoded bytes.
      boolean match​(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)
      Check if the provide un-encoded data would match the encoded data if it was encoded.
    • Method Detail

      • getId

        String getId()
        Get the ID of this encoder.
        Returns:
        id
      • isOfType

        boolean isOfType​(byte[] encodedBytes,
                         String charset)
        Determine if this encoder may have been used to create the provided encoded bytes. This method should only be used if it is very likely to be the right encoder.
        Parameters:
        encodedBytes - encoded bytes
        charset - character set
        Returns:
        this almost certainly was encoded with a similar encoder
      • encode

        byte[] encode​(byte[] toEncode,
                      byte[] salt,
                      byte[] passphrase,
                      String charset)
               throws EncoderException
        Encode a string
        Parameters:
        toEncode - data to encode
        salt - salt if supported
        passphrase - passphrase if supported
        charset - character set
        Returns:
        encoded bytes
        Throws:
        EncoderException - if encoding fails
      • decode

        byte[] decode​(byte[] toDecode,
                      byte[] salt,
                      byte[] passphrase,
                      String charset)
               throws EncoderException
        Decode bytes (if supported) to text.
        Parameters:
        toDecode - bytes to decode
        salt - TODO
        passphrase - passphrase if supported
        charset - character set
        Returns:
        decoded text
        Throws:
        EncoderException - if encoding fails
        UnsupportedOperationException
      • match

        boolean match​(byte[] encodedData,
                      byte[] unencodedData,
                      byte[] passphrase,
                      String charset)
        Check if the provide un-encoded data would match the encoded data if it was encoded.
        Parameters:
        encodedData - encoded data
        unencodedData - un-encoded data
        passphrase - passphrase if supported
        charset - character set
        Returns:
        matches