Class Utils.ByteUtils

java.lang.Object
net.risingworld.api.utils.Utils.ByteUtils
Enclosing class:
Utils

public abstract static class Utils.ByteUtils extends Object
Contains various byte functions, i.e encryption and compression of byte arrays etc.
  • Constructor Details

    • ByteUtils

      public ByteUtils()
  • Method Details

    • compress

      public static byte[] compress(byte[] input)
      Compresses a byte array.
      Parameters:
      input - the byte array to compress.
      Returns:
      the compressed byte array, or null if something went wrong.
    • decompress

      public static byte[] decompress(byte[] input)
      Decompresses a byte array.
      Parameters:
      input - the compressed array to decompress.
      Returns:
      the decompressed byte array, or null if something went wrong.
    • getMd5

      public static String getMd5(byte[] input)
      Generates an MD5 hash from the provided byte array.This is useful for checksums etc.
      Parameters:
      input - the byte array you want to turn into an MD5 hash.
      Returns:
      an MD5 hash as a string.
    • unsignedByteToInt

      public int unsignedByteToInt(byte b)
      Converts an unsigned byte to an int.
      Parameters:
      b - the unsigned byte.
      Returns:
      the int value.