Package me.saro.kit.bytes
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)reversestatic byte[]copy(byte[] data, int offset, int length, boolean reverse)reversestatic byte[]decodeBase64(java.lang.String base64)base64String to byte datastatic java.lang.StringdecodeBase64(java.lang.String base64, java.lang.String charset)base64 to textstatic java.lang.StringencodeBase64String(byte[] data)byte data to base64Stringstatic java.lang.StringencodeBase64String(java.lang.String text, java.lang.String charset)text to base64Stringstatic byteparseByte(java.lang.String value)static byte[]reverse(byte[] data)reverse bytestatic byte[]reverse(byte[] data, boolean reverse)reversestatic byte[]reverse(byte[] data, int offset, int length)reverse byte offset to lengthstatic byte[]reverse(byte[] data, int offset, int length, boolean reverse)reversestatic byte[]reverse(byte[] data, int offset, int length, int arrayLength)reverse byte offset to (length unit) * arrayLengthstatic byte[]toBytes(double val)double to bytesstatic byte[]toBytes(double[] val)double[] to bytesstatic byte[]toBytes(double[] val, int offset, int length)double[] to bytesstatic byte[]toBytes(float val)float to bytesstatic byte[]toBytes(float[] val)float[] to bytesstatic byte[]toBytes(float[] val, int offset, int length)float[] to bytesstatic byte[]toBytes(int val)int to bytesstatic byte[]toBytes(int[] val)int[] to bytesstatic byte[]toBytes(int[] val, int offset, int length)int[] to bytesstatic byte[]toBytes(long val)long to bytesstatic byte[]toBytes(long[] val)long[] to bytesstatic byte[]toBytes(long[] val, int offset, int length)long[] to bytesstatic byte[]toBytes(short val)short to bytesstatic byte[]toBytes(short[] val)short[] to bytesstatic byte[]toBytes(short[] val, int offset, int length)short[] to bytesstatic byte[]toBytesByHex(java.lang.String hex)to bytes by hex stringstatic doubletoDouble(byte[] val)bytes to doublestatic doubletoDouble(byte[] val, int offset)bytes to doublestatic 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 liststatic floattoFloat(byte[] val)bytes to floatstatic floattoFloat(byte[] val, int offset)bytes to floatstatic 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 liststatic java.lang.StringtoHex(byte[] bytes)bytes to hexstatic inttoInt(byte[] val)bytes to intstatic inttoInt(byte[] val, int offset)bytes to intstatic 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 liststatic longtoLong(byte[] val)bytes to longstatic longtoLong(byte[] val, int offset)bytes to longstatic 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 liststatic shorttoShort(byte[] val)bytes to shortstatic shorttoShort(byte[] val, int offset)bytes to shortstatic 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 liststatic java.lang.StringtoString(byte[] b, int offset, int length, java.lang.String charset)static java.lang.StringtoString(byte[] b, java.lang.String charset)
-
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:
-