Class Ecoji.Encoder

  • Enclosing class:
    Ecoji

    public static class Ecoji.Encoder
    extends java.lang.Object
    Encodes byte sources into a base-1024 representation with an emoji alphabet. Use one of the readFrom() methods to start the encoding process.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Ecoji.Encoder.Target
      An intermediate class, needed to implement the builder-like DSL for encoding.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Ecoji.Encoder.Target readFrom​(byte[] bytes)
      Uses the provided byte array as bytes source.
      Ecoji.Encoder.Target readFrom​(java.io.InputStream inputStream)
      Uses the provided InputStream as a bytes source.
      Ecoji.Encoder.Target readFrom​(java.lang.String string)
      Uses the provided string encoded in UTF-8 as bytes source.
      Ecoji.Encoder.Target readFrom​(java.lang.String string, java.nio.charset.Charset charset)
      Uses the provided string encoded in in the specified encoding as bytes source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readFrom

        public Ecoji.Encoder.Target readFrom​(java.io.InputStream inputStream)
        Uses the provided InputStream as a bytes source.

        The provided stream will be read entirely, however, it won't be closed automatically. There are no limitations on the contents of the stream.

        Parameters:
        inputStream - A sequence of bytes which should be encoded as emojis.
        Returns:
        An intermediate object used to specify the destination of the encoding process.
      • readFrom

        public Ecoji.Encoder.Target readFrom​(byte[] bytes)
        Uses the provided byte array as bytes source.
        Parameters:
        bytes - A byte array which should be encoded as emojis.
        Returns:
        an intermediate object used to specify the destination of the encoding process.
      • readFrom

        public Ecoji.Encoder.Target readFrom​(java.lang.String string)
        Uses the provided string encoded in UTF-8 as bytes source.
        Parameters:
        string - A string whose UTF-8 representation should be encoded as emojis.
        Returns:
        An intermediate object used to specify the destination of the encoding process.
      • readFrom

        public Ecoji.Encoder.Target readFrom​(java.lang.String string,
                                             java.nio.charset.Charset charset)
        Uses the provided string encoded in in the specified encoding as bytes source.
        Parameters:
        string - A string whose representation in the encoding defined by the charset parameter should be encoded as emoji.
        charset - A character encoding which should be used to convert the provided string to bytes.
        Returns:
        An intermediate object used to specify the destination of the encoding process.