public class Utils extends Object
Modifier and Type | Class and Description |
---|---|
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() |
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) |
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 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) |
static String |
parseVersionFromWSDLURL(String wsdlurl) |
static void |
print(PrintStream stream,
String message,
boolean onlyifverbose,
boolean verbosemode) |
static void |
println(PrintStream stream,
String message,
boolean onlyifverbose,
boolean verbosemode) |
static void |
startMulti(OutputStream out,
String filename,
String boundary,
String mimeType) |
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 definitionpublic static void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode)
public static void print(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode)
public static List<List<Object>> parseECLResults(String results)
results
- public static String eclResultsToString(List<List<Object>> resultlist, String celldelimiter, String rowdelimiter)
resultlist
- celldelimiter
- rowdelimiter
- public void writeField(OutputStream out, String boundary, String name, char value) throws IOException
name
- the field name (required)value
- the field valueIOException
- on input/output errorspublic void writeField(OutputStream out, String boundary, String name, String value) throws IOException
name
- the field name (required)value
- the field valueIOException
- on input/output errorspublic void writeFile(OutputStream out, String name, String mimeType, File file) throws IOException
out
- name
- mimeType
- file
- IOException
public void writeFile(OutputStream out, String boundary, String name, String mimeType, String fileName, InputStream is) throws IOException
java.lang.IllegalArgumentException
will be thrown.IOException
public static void writeFile(OutputStream out, String boundary, String mimeType, String fileName, byte[] data) throws IOException
IOException
public static void startMulti(OutputStream out, String filename, String boundary, String mimeType) throws IOException
IOException
public static void closeMulti(OutputStream out, String boundary) throws IOException
IOException
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.IOException
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)
enumclass
- reference to target enumarationstrvalue
- string value to be mapped to enum valueIllegalArgumentException
- if strvalue cannot be mapped to
given enumCopyright © 2017. All rights reserved.