Class Codec


  • public class Codec
    extends java.lang.Object
    Utility class to encode arbitrary Strings to fit in a single text line. For any string s, encode(s) is a string that does not contain \r or \n and s.equals(decode(encode(s))) holds.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull java.lang.String decode​(@NotNull java.lang.String str)
      Decodes a string which was encoded by encode(String).
      static @NotNull java.lang.String encode​(@NotNull java.lang.String str)
      Encodes a string to make it fit into one line.
      • Methods inherited from class java.lang.Object

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

      • encode

        @NotNull
        public static @NotNull java.lang.String encode​(@NotNull
                                                       @NotNull java.lang.String str)
        Encodes a string to make it fit into one line.
        Parameters:
        str - the string to be encoded
        Returns:
        the encoded string
        See Also:
        decode(String)
      • decode

        @NotNull
        public static @NotNull java.lang.String decode​(@NotNull
                                                       @NotNull java.lang.String str)
        Decodes a string which was encoded by encode(String).
        Parameters:
        str - the string to be decoded
        Returns:
        the decoded string
        See Also:
        encode(String)