Class EncodableHelper


  • public final class EncodableHelper
    extends Object
    • Field Detail

      • logger

        static Logger logger
      • charset

        static final Charset charset
        Default charset used to encode/decode String.
      • multibyte

        private static final boolean multibyte
        Attributes allowing to compute encoded String size.
      • utf8

        private static final boolean utf8
    • Constructor Detail

      • EncodableHelper

        public EncodableHelper()
    • Method Detail

      • getStringEncodedSize

        public static final int getStringEncodedSize​(String s)
        Returns the size of an encoded string. Be careful, String are now encoded as UTF-8.
        Parameters:
        s - the string to encode
        Returns:
        the size of the encoded string
      • getNullableStringEncodedSize

        public static final int getNullableStringEncodedSize​(String s)
        Returns the size of an encoded string which value may be null. Be careful, String are now encoded as UTF-8.
        Parameters:
        s - the string to encode
        Returns:
        the size of the encoded string
      • getByteArrayEncodedSize

        public static final int getByteArrayEncodedSize​(byte[] byteArray)
      • getNullableByteArrayEncodedSize

        public static final int getNullableByteArrayEncodedSize​(byte[] byteArray)
      • getNullableByteArrayEncodedSize

        public static final int getNullableByteArrayEncodedSize​(byte[] byteArray,
                                                                int length)