程序包 com.ajaxjs.util

类 StringBytes

java.lang.Object
com.ajaxjs.util.StringBytes

public class StringBytes extends Object
Convert String to bytes and bytes to String Actually, you can use `new String(bytes)`/`str.getBytes()` more easily.
  • 构造器详细资料

    • StringBytes

      public StringBytes(String string)
      Constructor.
      参数:
      string - String to convert.
    • StringBytes

      public StringBytes(byte[] bytes)
      Constructor.
      参数:
      bytes - Bytes to convert.
  • 方法详细资料

    • getBytes

      public byte[] getBytes(Charset charset)
      Convert String to bytes.
      参数:
      charset - Charset to use.
      返回:
      Bytes
    • getBytes

      public byte[] getBytes()
      Convert String to bytes. Uses platform default charset.
      返回:
      Bytes
    • getUTF8_Bytes

      public byte[] getUTF8_Bytes()
      Convert String to bytes. Uses UTF-8 charset.
      返回:
      Bytes
    • getString

      public String getString(Charset charset)
      Convert bytes to String.
      参数:
      charset - Charset to use.
      返回:
      String with given charset.
    • getString

      public String getString()
      Convert bytes to String. Uses platform default charset.
      返回:
      String with platform default charset.
    • getUTF8_String

      public String getUTF8_String()
      Convert bytes to String. Uses UTF-8 charset.
      返回:
      String with UTF-8 charset.
    • showPlatformDefaultCharset

      public static String showPlatformDefaultCharset()
      Show platform default charset.
      返回:
      Platform default charset.