Class Functions

java.lang.Object
com.reve.utils.Functions

public class Functions extends Object
  • Field Details

    • random

      public static final Random random
  • Constructor Details

    • Functions

      public Functions()
  • Method Details

    • getCallerLocation

      public static String getCallerLocation()
      Returns:
      the called parent location in string format
    • getCurrentLocation

      public static String getCurrentLocation()
      Returns:
      the called location in string format
    • getStackTrace

      public static String getStackTrace()
      Returns:
      the stack traces starting from the called place in printable format
    • getVBNextSequenceID

      public static long getVBNextSequenceID()
      Get a unique long value. Useful as an alternative of vbSequencer mysql
      Returns:
      a unique long value
    • readByte

      public static int readByte(InputStream is, byte[] data, int offset, int length) throws IOException
      Read the specific amount of bytes from the given InputStream to the byte array provided. This method is recommended to use when we prefer an exception also at the time remote side closes the socket.
      Parameters:
      is - bytes will be read from this instance of InputStream
      data - bytes will be saved into this byte array.
      offset - starting index of the byte array where data should be saved.
      length - total length to be read from the stream.
      Returns:
      the number of successfully read bytes.
      Throws:
      IOException - when reach the end of file of the given stream.
    • readLine

      public static int readLine(InputStream is, byte[] data, int offset) throws IOException
      Read one line of String from the given InputStream to the byte array provided. This method is recommended to use when we prefer an exception also at the time remote side closes the socket.
      Parameters:
      is - bytes will be read from this instance of InputStream
      data - bytes will be saved into this byte array.
      offset - starting index of the byte array where data should be saved.
      Returns:
      the number of successfully read bytes.
      Throws:
      IOException - when reach the end of file of the given stream.