Class Common
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.Common
-
public final class Common extends Object
This class define common constants.- Since:
- 1.0
- Author:
- Laurent Jourdren
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiderrorExit(Throwable e, String message)Print error message to the user and exits the application.static voiderrorExit(Throwable e, String message, boolean logMessage)Print error message to the user and exits the application.static voiderrorHalt(Throwable e, String message)Print error message to the user and halts the application.static voiderrorHalt(Throwable e, String message, boolean logMessage)Print error message to the user and halts the application.static voidexit(int exitCode)Exit the application.static intgetThreadsNumber(int localThreads, int maxLocalThreads)Get the number of threads to use from localThreads, maxLocalThreads and global threads number.static voidhalt(int exitCode)Exit the application.static voidprintWarning(String message)Print warning.static voidsendMail(String subject, String message)static voidshowAndLogErrorMessage(String message)Show and log an error message.static voidshowErrorMessageAndExit(String message)Show a message and then exit.static voidshowMessageAndExit(String message)Show a message and then exit.static voidwriteLog(File file, long startTime, String data)Write log data.static voidwriteLog(OutputStream os, long startTime, String data)Write log data.
-
-
-
Method Detail
-
writeLog
public static void writeLog(OutputStream os, long startTime, String data) throws IOException
Write log data.- Parameters:
os- OutputStream of the log filedata- data to write- Throws:
IOException- if an error occurs while writing log file
-
writeLog
public static void writeLog(File file, long startTime, String data) throws IOException
Write log data.- Parameters:
file- the log filedata- data to write- Throws:
IOException- if an error occurs while writing log file
-
showMessageAndExit
public static void showMessageAndExit(String message)
Show a message and then exit.- Parameters:
message- the message to show
-
showAndLogErrorMessage
public static void showAndLogErrorMessage(String message)
Show and log an error message.- Parameters:
message- message to show and log
-
showErrorMessageAndExit
public static void showErrorMessageAndExit(String message)
Show a message and then exit.- Parameters:
message- the message to show
-
errorExit
public static void errorExit(Throwable e, String message)
Print error message to the user and exits the application.- Parameters:
e- Exceptionmessage- message to show to the use
-
errorExit
public static void errorExit(Throwable e, String message, boolean logMessage)
Print error message to the user and exits the application.- Parameters:
e- Exceptionmessage- message to show to the uselogMessage- true if message must be logged
-
errorHalt
public static void errorHalt(Throwable e, String message)
Print error message to the user and halts the application.- Parameters:
e- Exceptionmessage- message to show to the use
-
errorHalt
public static void errorHalt(Throwable e, String message, boolean logMessage)
Print error message to the user and halts the application.- Parameters:
e- Exceptionmessage- message to show to the uselogMessage- true if message must be logged
-
exit
public static void exit(int exitCode)
Exit the application.- Parameters:
exitCode- exit code
-
halt
public static void halt(int exitCode)
Exit the application.- Parameters:
exitCode- exit code
-
getThreadsNumber
public static int getThreadsNumber(int localThreads, int maxLocalThreads)Get the number of threads to use from localThreads, maxLocalThreads and global threads number.- Parameters:
localThreads- number of threadsmaxLocalThreads- maximum number of threads- Returns:
- the number of threads to use
-
printWarning
public static void printWarning(String message)
Print warning.- Parameters:
message- message to print
-
-