Package com.reve.utils
Class Functions
java.lang.Object
com.reve.utils.Functions
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic Stringstatic StringgetRandomNumericString(int len) Get random numeric string value of given length.static Stringstatic longGet a unique long value.static longGet a unique long value.static intreadByte(InputStream is, byte[] data, int offset, int length) Read the specific amount of bytes from the givenInputStreamto the byte array provided.static intreadLine(InputStream is, byte[] data, int offset) Read one line of String from the givenInputStreamto the byte array provided.
-
Field Details
-
random
-
-
Constructor Details
-
Functions
public Functions()
-
-
Method Details
-
getCallerLocation
- Returns:
- the called parent location in string format
-
getCurrentLocation
- Returns:
- the called location in string format
-
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
-
getUniqueLong
public static long getUniqueLong()Get a unique long value. Useful as an alternative of vbSequencer mysql- Returns:
- a unique long value
-
readByte
Read the specific amount of bytes from the givenInputStreamto 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 ofInputStreamdata- 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
Read one line of String from the givenInputStreamto 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 ofInputStreamdata- 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.
-
getRandomNumericString
Get random numeric string value of given length.- Parameters:
len- Defines the length of string that should be generated.- Returns:
- the randomly generated numeric string of given length
-