Package io.github.netvl.ecoji
Class Ecoji
- java.lang.Object
-
- io.github.netvl.ecoji.Ecoji
-
public final class Ecoji extends java.lang.Object
The main entry point for Ecoji encoding/decoding.Use the
getEncoder()
andgetDecoder()
methods to obtain an instance ofEcoji.Encoder
andEcoji.Decoder
, respectively. These classes can then be used to read encoded or decoded data and produce base-1024 decoded or encoded data.As a general rule, for
Ecoji.Encoder
the input is anInputStream
and the output is aWriter
. ForEcoji.Decoder
it's in the opposite way: the input is aReader
and the output is aOutputStream
. However, both provide convenience methods to encode from or decode toString
s andbyte[]
s.For example:
String encoded = Ecoji.getEncoder().readFrom("hello world").writeToString(); String decoded = Ecoji.getDecoder().readFrom(encoded).writeToString(); assert decoded.equals("hello world");
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Ecoji.Decoder
Decodes Unicode character sources from a base-1024 representation with an emoji alphabet into bytes.static class
Ecoji.Encoder
Encodes byte sources into a base-1024 representation with an emoji alphabet.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Ecoji.Decoder
getDecoder()
Returns an instance of theEcoji.Decoder
class, which can then be used to decode a stream or a sequence of characters which is an Ecoji representation of a byte stream into the original sequence of bytes.static Ecoji.Encoder
getEncoder()
Returns an instance of theEcoji.Encoder
class, which can then be used to encode any stream or sequence of bytes into a base-1024 representation.
-
-
-
Method Detail
-
getEncoder
public static Ecoji.Encoder getEncoder()
Returns an instance of theEcoji.Encoder
class, which can then be used to encode any stream or sequence of bytes into a base-1024 representation.- Returns:
- An instance of
Ecoji.Encoder
.
-
getDecoder
public static Ecoji.Decoder getDecoder()
Returns an instance of theEcoji.Decoder
class, which can then be used to decode a stream or a sequence of characters which is an Ecoji representation of a byte stream into the original sequence of bytes.- Returns:
- An instance of
Ecoji.Decoder
.
-
-