public final class ConnectorIOUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMPRESSION_ALGO_DEFLATE
Using the compression algoritme "deflate" as specified in the RFC1951
|
static String |
COMPRESSION_ALGO_GZIP
Using the compression algoritme "GZIP" as specified in the RFC1952
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
base64Decode(byte[] input,
boolean recursive)
Helper method to decode base64 byte[] with or without recursivity.
|
static void |
closeQuietly(Object... closeables)
Helper method to close quietly an object with the close method.
|
static void |
closeQuietly(Object closeable)
Helper method to close quietly an object with the close method.
|
static byte[] |
compress(byte[] input)
Compress the given byte[] by using the
COMPRESSION_ALGO_GZIP |
static byte[] |
compress(byte[] input,
String algo)
Compress the given byte[] by using the specified algorithm.
|
static void |
compress(InputStream in,
OutputStream out,
String algo)
Compress the given
InputStream by using the specified algo to the given OutputStream |
static String |
convertStreamToString(InputStream is)
Convert the given
InputStream to a String |
static File |
createTempFile(String name)
Given a filename creates a temp file based on the java.io.tmpdir System property.
|
static File |
createTempFile(String name,
boolean create) |
static byte[] |
decompress(byte[] input)
De-compress the given byte[]
|
static InputStream |
decompress(InputStream input)
De-compress the given
InputStream by detecting the used algorithm. |
static void |
decompress(InputStream in,
OutputStream out,
boolean noWrap)
|
static byte[] |
getBytes(InputStream inputStream)
Get the bytes from the given
InputStream |
static byte[] |
getResourceAsByteArray(String location)
Gets content of the location as byte[]
|
static File |
getResourceAsFile(String location)
Gets content of the location as
File |
static InputStream |
getResourceAsStream(String location)
Gets the location as
InputStream |
static InputStream |
getResourceAsStream(String location,
boolean bootstrap)
Gets the location as
InputStream |
static String |
getResourceAsString(String location)
Gets content of the location as
String |
static String |
getResourceFilePath(String location)
Gets the resource as stream.
|
static String |
getTempFileLocation(String name)
t Given a filename builds a temp file location path based on the java.io.tmpdir System property.
|
static byte[] |
toBytes(String content,
Charset charsetName)
|
static String |
toString(byte[] message,
Charset charsetName)
|
public static final String COMPRESSION_ALGO_DEFLATE
public static final String COMPRESSION_ALGO_GZIP
public static byte[] getBytes(InputStream inputStream) throws TechnicalConnectorException
InputStream
Note: the given stream is closed.
TechnicalConnectorException
public static byte[] toBytes(String content, Charset charsetName) throws TechnicalConnectorException
TechnicalConnectorException
public static String toString(byte[] message, Charset charsetName) throws TechnicalConnectorException
TechnicalConnectorException
public static byte[] compress(byte[] input) throws TechnicalConnectorException
COMPRESSION_ALGO_GZIP
TechnicalConnectorException
public static void compress(InputStream in, OutputStream out, String algo) throws TechnicalConnectorException
InputStream
by using the specified algo to the given OutputStream
Note:None of the streams are closed.
TechnicalConnectorException
public static byte[] compress(byte[] input, String algo) throws TechnicalConnectorException
TechnicalConnectorException
public static void decompress(InputStream in, OutputStream out, boolean noWrap) throws TechnicalConnectorException
InputStream
to the given OutputStream
using the Inflater
with or without wrap.
Note:None of the streams are closed.
TechnicalConnectorException
public static byte[] decompress(byte[] input) throws TechnicalConnectorException
TechnicalConnectorException
public static InputStream decompress(InputStream input) throws TechnicalConnectorException
InputStream
by detecting the used algorithm.TechnicalConnectorException
public static InputStream getResourceAsStream(String location) throws TechnicalConnectorException
InputStream
Note: technical connector is bootstrapped.
TechnicalConnectorException
public static String getResourceAsString(String location) throws TechnicalConnectorException
String
Note: technical connector is bootstrapped.
TechnicalConnectorException
public static byte[] getResourceAsByteArray(String location) throws TechnicalConnectorException
Note: technical connector is bootstrapped.
TechnicalConnectorException
public static InputStream getResourceAsStream(String location, boolean bootstrap) throws TechnicalConnectorException
InputStream
Note: technical connector can be bootstrapped.
TechnicalConnectorException
public static File getResourceAsFile(String location) throws TechnicalConnectorException
File
Note: technical connector is bootstrapped.
TechnicalConnectorException
public static String getResourceFilePath(String location) throws TechnicalConnectorException
location
- the locationTechnicalConnectorException
- throws an TechnicalConnectorException when resoure is not found.public static String convertStreamToString(InputStream is) throws TechnicalConnectorException
InputStream
to a String
Note: the inputstream is closed.
TechnicalConnectorException
public static void closeQuietly(Object closeable)
public static void closeQuietly(Object... closeables)
public static byte[] base64Decode(byte[] input, boolean recursive) throws TechnicalConnectorException
TechnicalConnectorException
public static File createTempFile(String name) throws TechnicalConnectorException
File.createTempFile(String, String)
File.createTempFile} it throws a checked exception if the java.io.tmpdir System property is not defined.name
- the file nameTechnicalConnectorException
- if the supplied name is empty or the java.io.tmpdir System property is not set.public static String getTempFileLocation(String name) throws TechnicalConnectorException
name
- the file nameTechnicalConnectorException
- if the supplied name is empty or the java.io.tmpdir System property is not set.public static File createTempFile(String name, boolean create) throws TechnicalConnectorException
TechnicalConnectorException
Connector Packaging TECHNICAL 4.1.2 API
Copyright © {inceptionYear}-2022 eHealth. All Rights Reserved.