|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbe.ehealth.technicalconnector.utils.ConnectorIOUtils
public final class ConnectorIOUtils
Utility class for General IO stream manipulation.
| Field Summary | |
|---|---|
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 |
| Method Summary | |
|---|---|
static byte[] |
base64Decode(byte[] input)
Deprecated. use base64Decode(byte[], boolean) |
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(boolean noWrap,
byte[] input)
Deprecated. Replaced by compress(byte[])
Note:noWrap parameter is not longer used. |
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 byte[] |
decompress(boolean noWrap,
byte[] input)
Deprecated. Replaced by compress(byte[])
Note:noWrap parameter is not longer used. |
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)
Compress the given InputStream to the given OutputStream using the Inflater with or without wrap. |
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)
Given a filename builds a temp file location path based on the java.io.tmpdir System property. |
static byte[] |
toBytes(String content,
Charset charsetName)
Get the bytes from the given String by using the correct Charset |
static String |
toString(byte[] message,
Charset charsetName)
Convert the given byte[] to a String by using the corrrect Charset |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String COMPRESSION_ALGO_DEFLATE
public static final String COMPRESSION_ALGO_GZIP
| Method Detail |
|---|
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
String by using the correct Charset
TechnicalConnectorException
public static String toString(byte[] message,
Charset charsetName)
throws TechnicalConnectorException
String by using the corrrect Charset
TechnicalConnectorException
public static byte[] compress(byte[] input)
throws TechnicalConnectorException
COMPRESSION_ALGO_GZIP
TechnicalConnectorException
@Deprecated
public static byte[] compress(boolean noWrap,
byte[] input)
throws TechnicalConnectorException
compress(byte[])
Note:noWrap parameter is not longer used.
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
@Deprecated
public static byte[] decompress(boolean noWrap,
byte[] input)
throws TechnicalConnectorException
compress(byte[])
Note:noWrap parameter is not longer used.
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 location
TechnicalConnectorException - 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.
TechnicalConnectorExceptionpublic static void closeQuietly(Object closeable)
public static void closeQuietly(Object... closeables)
@Deprecated
public static byte[] base64Decode(byte[] input)
throws TechnicalConnectorException
base64Decode(byte[], boolean)
Note: there is no recursivity when applying base64
TechnicalConnectorException
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 name
TechnicalConnectorException - 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 name
TechnicalConnectorException - if the supplied name is empty or the java.io.tmpdir System property is not set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||