Interface IEncoder

    • Method Detail

      • runEncoders

        static <T> T runEncoders​(List<Function<T,​T>> functions,
                                 T t)
        Given a collection of IPipelineStep execute them in sequence given a Stream input. functions take the output of the previous step as the input of the current step etc. Similar to running a pipeline.
        Parameters:
        functions - List of Function
        t - String
        Returns:
        String
      • reset

        void reset()
        Reset state in this encoder in preparation for processing new content.
      • setOptions

        void setOptions​(IParameters params,
                        String encoding,
                        String lineBreak)
        Sets the options for this encoder.
        Parameters:
        params - the parameters object with all the configuration information specific to this encoder.
        encoding - the name of the charset encoding to use.
        lineBreak - the type of line break to use.
      • encode

        String encode​(String text,
                      EncoderContext context)
        Encodes a given text with this encoder.
        Parameters:
        text - the text to encode.
        context - the context of the text: 0=text, 1=skeleton, 2=inline.
        Returns:
        the encoded text.
      • encode

        String encode​(int codePoint,
                      EncoderContext context)
        Encodes a given code-point with this encoding. If this method is called from a loop it is assumed that the code point is tested by the caller to know if it is a supplemental one or not and and any index update to skip the low surrogate part of the pair is done on the caller side.
        Parameters:
        codePoint - the code-point to encode.
        context - the context of the character: 0=text, 1=skeleton, 2=inline.
        Returns:
        the encoded character (as a string since it can be now made up of more than one character).
      • encode

        String encode​(char value,
                      EncoderContext context)
        Encodes a given character with this encoding.
        Parameters:
        value - the character to encode.
        context - the context of the character: 0=text, 1=skeleton, 2=inline.
        Returns:
        the encoded character 9as a string since it can be now made up of more than one character).
      • toNative

        default String toNative​(String propertyName,
                                String value)
        Converts any property values from its standard representation to the native representation for this encoder.
        Parameters:
        propertyName - the name of the property.
        value - the standard value to convert.
        Returns:
        the native representation of the given value.
      • getLineBreak

        default String getLineBreak()
        Gets the line-break to use for this encoder.
        Returns:
        the line-break used for this encoder.
      • getEncoding

        default String getEncoding()
        Gets the name of the charset encoding to use.
        Returns:
        the charset encoding used for this encoder.
      • getCharsetEncoder

        default CharsetEncoder getCharsetEncoder()
        Gets the character set encoder used for this encoder.
        Returns:
        the character set encoder used for this encoder. This can be null.
      • getParameters

        IParameters getParameters()
        Gets the parameters object with all the configuration information specific to this encoder.
        Returns:
        the parameters object used for this encoder. This can be null.