Class Bytes

java.lang.Object
me.saro.kit.bytes.Bytes

public class Bytes
extends java.lang.Object
bytes
Since:
1.0.0
Author:
PARK Yong Seo
  • Method Summary

    Modifier and Type Method Description
    static byte[] copy​(byte[] data, boolean reverse)
    reverse
    static byte[] copy​(byte[] data, int offset, int length, boolean reverse)
    reverse
    static byte[] decodeBase64​(java.lang.String base64)
    base64String to byte data
    static java.lang.String decodeBase64​(java.lang.String base64, java.lang.String charset)
    base64 to text
    static java.lang.String encodeBase64String​(byte[] data)
    byte data to base64String
    static java.lang.String encodeBase64String​(java.lang.String text, java.lang.String charset)
    text to base64String
    static byte parseByte​(java.lang.String value)  
    static byte[] reverse​(byte[] data)
    reverse byte
    static byte[] reverse​(byte[] data, boolean reverse)
    reverse
    static byte[] reverse​(byte[] data, int offset, int length)
    reverse byte offset to length
    static byte[] reverse​(byte[] data, int offset, int length, boolean reverse)
    reverse
    static byte[] reverse​(byte[] data, int offset, int length, int arrayLength)
    reverse byte offset to (length unit) * arrayLength
    static byte[] toBytes​(double val)
    double to bytes
    static byte[] toBytes​(double[] val)
    double[] to bytes
    static byte[] toBytes​(double[] val, int offset, int length)
    double[] to bytes
    static byte[] toBytes​(float val)
    float to bytes
    static byte[] toBytes​(float[] val)
    float[] to bytes
    static byte[] toBytes​(float[] val, int offset, int length)
    float[] to bytes
    static byte[] toBytes​(int val)
    int to bytes
    static byte[] toBytes​(int[] val)
    int[] to bytes
    static byte[] toBytes​(int[] val, int offset, int length)
    int[] to bytes
    static byte[] toBytes​(long val)
    long to bytes
    static byte[] toBytes​(long[] val)
    long[] to bytes
    static byte[] toBytes​(long[] val, int offset, int length)
    long[] to bytes
    static byte[] toBytes​(short val)
    short to bytes
    static byte[] toBytes​(short[] val)
    short[] to bytes
    static byte[] toBytes​(short[] val, int offset, int length)
    short[] to bytes
    static byte[] toBytesByHex​(java.lang.String hex)
    to bytes by hex string
    static double toDouble​(byte[] val)
    bytes to double
    static double toDouble​(byte[] val, int offset)
    bytes to double
    static double[] toDoubleArray​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to double[]
    static java.util.List<java.lang.Double> toDoubleList​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to double list
    static float toFloat​(byte[] val)
    bytes to float
    static float toFloat​(byte[] val, int offset)
    bytes to float
    static float[] toFloatArray​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to float[]
    static java.util.List<java.lang.Float> toFloatList​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to float list
    static java.lang.String toHex​(byte[] bytes)
    bytes to hex
    static int toInt​(byte[] val)
    bytes to int
    static int toInt​(byte[] val, int offset)
    bytes to int
    static int[] toIntArray​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to int[]
    static java.util.List<java.lang.Integer> toIntegerList​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to integer list
    static long toLong​(byte[] val)
    bytes to long
    static long toLong​(byte[] val, int offset)
    bytes to long
    static long[] toLongArray​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to long[]
    static java.util.List<java.lang.Long> toLongList​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to long list
    static short toShort​(byte[] val)
    bytes to short
    static short toShort​(byte[] val, int offset)
    bytes to short
    static short[] toShortArray​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to short[]
    static java.util.List<java.lang.Short> toShortList​(byte[] bytes, int bytesOffset, int arrayLength)
    bytes to short list
    static java.lang.String toString​(byte[] b, int offset, int length, java.lang.String charset)  
    static java.lang.String toString​(byte[] b, java.lang.String charset)  

    Methods inherited from class java.lang.Object

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

    • toHex

      public static java.lang.String toHex​(byte[] bytes)
      bytes to hex
      Parameters:
      bytes -
      Returns:
    • toBytesByHex

      public static byte[] toBytesByHex​(java.lang.String hex)
      to bytes by hex string
      Parameters:
      hex -
      Returns:
    • encodeBase64String

      public static java.lang.String encodeBase64String​(byte[] data)
      byte data to base64String
      Parameters:
      data -
      Returns:
    • encodeBase64String

      public static java.lang.String encodeBase64String​(java.lang.String text, java.lang.String charset)
      text to base64String
      Parameters:
      text -
      charset -
      Returns:
    • decodeBase64

      public static byte[] decodeBase64​(java.lang.String base64)
      base64String to byte data
      Parameters:
      base64 -
      Returns:
    • decodeBase64

      public static java.lang.String decodeBase64​(java.lang.String base64, java.lang.String charset)
      base64 to text
      Parameters:
      base64 -
      charset -
      Returns:
    • toBytes

      public static byte[] toBytes​(short val)
      short to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(short[] val)
      short[] to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(short[] val, int offset, int length)
      short[] to bytes
      Parameters:
      val -
      offset -
      length -
      Returns:
    • toBytes

      public static byte[] toBytes​(int val)
      int to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(int[] val)
      int[] to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(int[] val, int offset, int length)
      int[] to bytes
      Parameters:
      val -
      offset -
      length -
      Returns:
    • toBytes

      public static byte[] toBytes​(long val)
      long to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(long[] val)
      long[] to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(long[] val, int offset, int length)
      long[] to bytes
      Parameters:
      val -
      offset -
      length -
      Returns:
    • toBytes

      public static byte[] toBytes​(float val)
      float to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(float[] val)
      float[] to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(float[] val, int offset, int length)
      float[] to bytes
      Parameters:
      val -
      offset -
      length -
      Returns:
    • toBytes

      public static byte[] toBytes​(double val)
      double to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(double[] val)
      double[] to bytes
      Parameters:
      val -
      Returns:
    • toBytes

      public static byte[] toBytes​(double[] val, int offset, int length)
      double[] to bytes
      Parameters:
      val -
      offset -
      length -
      Returns:
    • toShort

      public static short toShort​(byte[] val, int offset)
      bytes to short
      Parameters:
      val -
      offset -
      Returns:
    • toShortArray

      public static short[] toShortArray​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to short[]
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toShortList

      public static java.util.List<java.lang.Short> toShortList​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to short list
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toShort

      public static short toShort​(byte[] val)
      bytes to short
      Parameters:
      val -
      Returns:
    • toInt

      public static int toInt​(byte[] val, int offset)
      bytes to int
      Parameters:
      val -
      offset -
      Returns:
    • toIntArray

      public static int[] toIntArray​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to int[]
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toIntegerList

      public static java.util.List<java.lang.Integer> toIntegerList​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to integer list
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toInt

      public static int toInt​(byte[] val)
      bytes to int
      Parameters:
      val -
      Returns:
    • toLong

      public static long toLong​(byte[] val, int offset)
      bytes to long
      Parameters:
      val -
      offset -
      Returns:
    • toLongArray

      public static long[] toLongArray​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to long[]
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toLongList

      public static java.util.List<java.lang.Long> toLongList​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to long list
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toLong

      public static long toLong​(byte[] val)
      bytes to long
      Parameters:
      val -
      Returns:
    • toFloat

      public static float toFloat​(byte[] val, int offset)
      bytes to float
      Parameters:
      val -
      offset -
      Returns:
    • toFloatArray

      public static float[] toFloatArray​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to float[]
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toFloatList

      public static java.util.List<java.lang.Float> toFloatList​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to float list
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toFloat

      public static float toFloat​(byte[] val)
      bytes to float
      Parameters:
      val -
      Returns:
    • toDouble

      public static double toDouble​(byte[] val, int offset)
      bytes to double
      Parameters:
      val -
      offset -
      Returns:
    • toDoubleArray

      public static double[] toDoubleArray​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to double[]
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toDoubleList

      public static java.util.List<java.lang.Double> toDoubleList​(byte[] bytes, int bytesOffset, int arrayLength)
      bytes to double list
      Parameters:
      bytes -
      bytesOffset -
      arrayLength -
      Returns:
    • toDouble

      public static double toDouble​(byte[] val)
      bytes to double
      Parameters:
      val -
      Returns:
    • copy

      public static byte[] copy​(byte[] data, boolean reverse)
      reverse
      Parameters:
      data -
      reverse - true : do reverse, false : n/a
    • copy

      public static byte[] copy​(byte[] data, int offset, int length, boolean reverse)
      reverse
      Parameters:
      data -
      reverse - true : do reverse, false : just copy
    • reverse

      public static byte[] reverse​(byte[] data, boolean reverse)
      reverse
      Parameters:
      data -
      reverse - true : do reverse, false : n/a
    • reverse

      public static byte[] reverse​(byte[] data, int offset, int length, boolean reverse)
      reverse
      Parameters:
      data -
      reverse - true : do reverse, false : n/a
    • reverse

      public static byte[] reverse​(byte[] data)
      reverse byte
      Parameters:
      data -
    • reverse

      public static byte[] reverse​(byte[] data, int offset, int length)
      reverse byte offset to length
      Parameters:
      data -
      offset -
      length -
    • parseByte

      public static byte parseByte​(java.lang.String value)
      Parameters:
      value -
      Returns:
    • reverse

      public static byte[] reverse​(byte[] data, int offset, int length, int arrayLength)
      reverse byte offset to (length unit) * arrayLength
      Parameters:
      data -
      offset -
      length -
      arrayLength -
    • toString

      public static java.lang.String toString​(byte[] b, java.lang.String charset)
      Parameters:
      b -
      charset -
      Returns:
    • toString

      public static java.lang.String toString​(byte[] b, int offset, int length, java.lang.String charset)
      Parameters:
      b -
      offset -
      length -
      charset -
      Returns: