public class Utils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Utils.HPCCEnvOSCode
HPCC Environment OS codes as defined in
/HPCC-Platform/common/environment/environment.hpp
|
static class |
Utils.LogLevel |
static class |
Utils.OSType |
| Modifier and Type | Field and Description |
|---|---|
protected static Utils.OSType |
detectedOS |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeMulti(OutputStream out,
String boundary)
Finishes multipart and closes stream.
|
static String |
createBoundary()
creates a Multipart boundry based on current time.
|
static URLConnection |
createConnection(URL url)
Creates a new
java.net.URLConnection object from the
specified java.net.URL. |
static boolean |
currentOSisLinux()
Current O sis linux.
|
static String |
dateToUTCString(Date date)
Date to UTC string.
|
static String |
eclResultsToString(List<List<Object>> resultlist,
String celldelimiter,
String rowdelimiter)
Serializes results object List of Object Lists to string in table format.
|
static String |
extactResultSchema(String results)
Extact result schema.
|
static <T extends Enum<T>> |
findEnumValFromString(Class<T> enumclass,
String strvalue)
Attempts to map a string value to an enum value of
a given enum class.
|
static Utils.OSType |
getOperatingSystemType()
detect the operating system from the os.name System property and cache
the result
|
static void |
log(String message,
Utils.LogLevel logLevel)
Log.
|
static List<List<Object>> |
parseECLResults(String results)
populates results object (List of Object Lists) based on HPCC result set string.
|
static List<List<Object>> |
parseOutResultSchema(String results)
Parses the out result schema.
|
static String |
parseVersionFromWSDLURL(String wsdlurl)
Parses the version from WSDLURL.
|
static void |
print(PrintStream stream,
String message,
boolean onlyifverbose,
boolean verbosemode)
Deprecated.
|
static void |
println(PrintStream stream,
String message,
boolean onlyifverbose,
boolean verbosemode)
Deprecated.
|
static void |
startMulti(OutputStream out,
String filename,
String boundary,
String mimeType)
Start multi.
|
static Date |
UTCStringToDate(String utc)
UTC string to date.
|
void |
writeField(OutputStream out,
String boundary,
String name,
char value)
Writes an char field value.
|
void |
writeField(OutputStream out,
String boundary,
String name,
String value)
Writes an string field value.
|
void |
writeFile(OutputStream out,
String name,
String mimeType,
File file)
Writes outputstream to file in local file system.
|
static void |
writeFile(OutputStream out,
String boundary,
String mimeType,
String fileName,
byte[] data)
Writes the given bytes.
|
void |
writeFile(OutputStream out,
String boundary,
String name,
String mimeType,
String fileName,
InputStream is)
Writes a input stream's contents.
|
protected static Utils.OSType detectedOS
public static String parseVersionFromWSDLURL(String wsdlurl)
wsdlurl - - url to web service definition@Deprecated public static void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode)
stream - the streammessage - the messageonlyifverbose - the onlyifverboseverbosemode - the verbosemode@Deprecated public static void print(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode)
stream - the streammessage - the messageonlyifverbose - the onlyifverboseverbosemode - the verbosemodepublic static void log(String message, Utils.LogLevel logLevel)
message - the messagelogLevel - the log levelpublic static List<List<Object>> parseECLResults(String results)
results - the resultspublic static String extactResultSchema(String results)
results - the resultspublic static List<List<Object>> parseOutResultSchema(String results)
results - the resultspublic static String eclResultsToString(List<List<Object>> resultlist, String celldelimiter, String rowdelimiter)
resultlist - the resultlistcelldelimiter - the celldelimiterrowdelimiter - the rowdelimiterpublic void writeField(OutputStream out, String boundary, String name, char value) throws IOException
out - the outboundary - the boundaryname - the field name (required)value - the field valueIOException - Signals that an I/O exception has occurred.public void writeField(OutputStream out, String boundary, String name, String value) throws IOException
out - the outboundary - the boundaryname - the field name (required)value - the field valueIOException - Signals that an I/O exception has occurred.public void writeFile(OutputStream out, String name, String mimeType, File file) throws IOException
out - the outname - the namemimeType - the mime typefile - the fileIOException - Signals that an I/O exception has occurred.public void writeFile(OutputStream out, String boundary, String name, String mimeType, String fileName, InputStream is) throws IOException
java.lang.IllegalArgumentException will be thrown.out - the outboundary - the boundaryname - the namemimeType - the mime typefileName - the file nameis - the isIOException - Signals that an I/O exception has occurred.public static void writeFile(OutputStream out, String boundary, String mimeType, String fileName, byte[] data) throws IOException
out - the outboundary - the boundarymimeType - the mime typefileName - the file namedata - the dataIOException - Signals that an I/O exception has occurred.public static void startMulti(OutputStream out, String filename, String boundary, String mimeType) throws IOException
out - the outfilename - the filenameboundary - the boundarymimeType - the mime typeIOException - Signals that an I/O exception has occurred.public static void closeMulti(OutputStream out, String boundary) throws IOException
out - the outboundary - the boundaryIOException - Signals that an I/O exception has occurred.public static URLConnection createConnection(URL url) throws IOException
java.net.URLConnection object from the
specified java.net.URL. This is a convenience method
which will set the doInput, doOutput,
useCaches and defaultUseCaches fields to
the appropriate settings in the correct order.url - the urlIOException - Signals that an I/O exception has occurred.public static String createBoundary()
public static Utils.OSType getOperatingSystemType()
public static boolean currentOSisLinux()
public static <T extends Enum<T>> T findEnumValFromString(Class<T> enumclass, String strvalue)
T - the generic typeenumclass - reference to target enumarationstrvalue - string value to be mapped to enum valueIllegalArgumentException - if strvalue cannot be mapped to
given enumpublic static String dateToUTCString(Date date)
date - - java date to convert to stringpublic static Date UTCStringToDate(String utc) throws ParseException
utc - - String in yyyy-mm-ddThh:MM:ssZ formatParseException - the parse exceptionCopyright © 2021. All rights reserved.