Package com.cyara.utilities
Class Utils
java.lang.Object
com.cyara.utilities.Utils
public class Utils
extends java.lang.Object
Various methods used throughout the samples for generic operations.
This is not an official Cyara product and is not officially supported. It is used for demonstration and training purposes. For assistance, contact chris.ryan@cyara.com
- Version:
- 1.0
- Author:
- Chris Ryan
-
Constructor Summary
Constructors Modifier Constructor Description private
Utils()
Instantiates a new Utils. -
Method Summary
Modifier and Type Method Description static int
getHeaderIndex(java.lang.String[] headerLineArr, java.lang.String desiredHeader)
Gets the index of an element in a String array.static boolean
logMessage(java.lang.String message, java.lang.String file, boolean removeNewLines)
Appends a String to a destination file.static void
sleepMode(int pauseLen)
Pauses the current thread for the specified number of milliseconds.
-
Constructor Details
-
Utils
private Utils()Instantiates a new Utils. Private to prevent instantiation.
-
-
Method Details
-
logMessage
public static boolean logMessage(java.lang.String message, java.lang.String file, boolean removeNewLines)Appends a String to a destination file.Adds a newline automatically to the end of the file.
- Parameters:
message
- The string we created that will be appended to the filefile
- The destination file where our string will be appendedremoveNewLines
- Flag whether or not to strip newlines from message- Returns:
- The boolean if the output was successful
- Since:
- 1.0
-
getHeaderIndex
public static int getHeaderIndex(java.lang.String[] headerLineArr, java.lang.String desiredHeader)Gets the index of an element in a String array.Used throughout the samples when processing CSVs
- Parameters:
headerLineArr
- The String array of headersdesiredHeader
- The specific header whose index we look for- Returns:
- The index our header is located at in the header row
- Since:
- 1.0
-
sleepMode
public static void sleepMode(int pauseLen)Pauses the current thread for the specified number of milliseconds.- Parameters:
pauseLen
- The length of time to pause in milliseconds- Since:
- 1.0
-