Class SimpleTools

java.lang.Object
i5.las2peer.tools.SimpleTools

public class SimpleTools extends Object
Collection of simple tools not large enough to form a separate class.
  • Field Details

  • Constructor Details

    • SimpleTools

      public SimpleTools()
  • Method Details

    • longHash

      public static long longHash(String s)
      Gets a long hash value from a given String
      Parameters:
      s -
      Returns:
      Returns the hash as long number
    • createRandomString

      public static String createRandomString(int length)
      create a random string of the given length with the possible characters from sRandomStringCharSet
      Parameters:
      length -
      Returns:
      a random string
    • join

      public static String join(Object[] objects, String glue)
      a simple join method to concatenate String representations of the given objects
      Parameters:
      objects -
      glue -
      Returns:
      join string
    • join

      public static String join(Iterable<?> objects, String glue)
      a simple join method to concatenate String representations of the given objects
      Parameters:
      objects -
      glue -
      Returns:
      join string
    • repeat

      public static String repeat(String string, int count)
      repeat a String count times
      Parameters:
      string -
      count -
      Returns:
      concatenated string
    • repeat

      public static String repeat(Object o, int count)
      repeat the string representation of the given object count times
      Parameters:
      o -
      count -
      Returns:
      concatenated string
    • toByteArray

      public static byte[] toByteArray(InputStream is) throws IOException
      Throws:
      IOException
    • byteToHexString

      public static String byteToHexString(byte[] bytes)
    • getSystemDefinedPort

      public static int getSystemDefinedPort()