Class SimpleTools

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

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

    Fields 
    Modifier and Type Field Description
    static java.lang.String sRandomStringCharSet
    set with available characters for random string generation via createRandomString(int)
  • Constructor Summary

    Constructors 
    Constructor Description
    SimpleTools()  
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String byteToHexString​(byte[] bytes)  
    static java.lang.String createRandomString​(int length)
    create a random string of the given length with the possible characters from sRandomStringCharSet
    static int getSystemDefinedPort()  
    static java.lang.String join​(java.lang.Iterable<?> objects, java.lang.String glue)
    a simple join method to concatenate String representations of the given objects
    static java.lang.String join​(java.lang.Object[] objects, java.lang.String glue)
    a simple join method to concatenate String representations of the given objects
    static long longHash​(java.lang.String s)
    Gets a long hash value from a given String
    static java.lang.String repeat​(java.lang.Object o, int count)
    repeat the string representation of the given object count times
    static java.lang.String repeat​(java.lang.String string, int count)
    repeat a String count times
    static byte[] toByteArray​(java.io.InputStream is)  

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • longHash

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

      public static java.lang.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 java.lang.String join​(java.lang.Object[] objects, java.lang.String glue)
      a simple join method to concatenate String representations of the given objects
      Parameters:
      objects -
      glue -
      Returns:
      join string
    • join

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

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

      public static java.lang.String repeat​(java.lang.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​(java.io.InputStream is) throws java.io.IOException
      Throws:
      java.io.IOException
    • byteToHexString

      public static java.lang.String byteToHexString​(byte[] bytes)
    • getSystemDefinedPort

      public static int getSystemDefinedPort()