Package be.business.connector.core.utils
Class IOUtils
- java.lang.Object
-
- be.business.connector.core.utils.IOUtils
-
public class IOUtils extends Object
The Class IOUtils.
-
-
Constructor Summary
Constructors Constructor Description IOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]compress(byte[] input)Compress.static intcopy(InputStream input, OutputStream output)Copy bytes from anInputStreamto anOutputStream.static longcopyLarge(InputStream input, OutputStream output)static longcopyLarge(InputStream input, OutputStream output, byte[] buffer)static byte[]decompress(byte[] unSealmessage)Decompress.static byte[]getBytes(InputStream inputStream)Gets the bytes.static List<String>getConfigurationFileList(String path, String configName)static StringgetEnvironment()static StringgetFileAsFullPath(String path)static List<String>getP12FileList(String path, String ssinRiziv)Gets the list of P12 files for a specific user (SSIN).static List<String>getP12OldFileList(String path, String ssinRiziv)static InputStreamgetResourceAsStream(String path)Gets the resource as stream.static byte[]loadResource(String path)Read stream.static StringstrConvert(byte[] message)Str convert.static byte[]toByte(String string)To byte.static byte[]toByteArray(InputStream input)Get the contents of anInputStreamas abyte[].
-
-
-
Method Detail
-
getBytes
public static byte[] getBytes(InputStream inputStream)
Gets the bytes.- Parameters:
inputStream- the input stream- Returns:
- the bytes
-
toByte
public static byte[] toByte(String string)
To byte. This dummy method is very usefull when running in dotNet!- Parameters:
string- the string- Returns:
- the byte[]
-
loadResource
public static byte[] loadResource(String path)
Read stream.- Parameters:
path- the path- Returns:
- the byte[]
-
compress
public static byte[] compress(byte[] input) throws IOExceptionCompress.- Parameters:
input- the input- Returns:
- the byte[]
- Throws:
IOException- Signals that an I/O exception has occurred.
-
decompress
public static byte[] decompress(byte[] unSealmessage) throws IOExceptionDecompress.- Parameters:
unSealmessage- the un sealmessage- Returns:
- the byte[]
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getResourceAsStream
public static InputStream getResourceAsStream(String path) throws IOException
Gets the resource as stream.- Parameters:
path- the path- Returns:
- the resource as stream
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getEnvironment
public static String getEnvironment() throws IOException
- Throws:
IOException
-
getFileAsFullPath
public static String getFileAsFullPath(String path) throws IOException
- Throws:
IOException
-
strConvert
public static String strConvert(byte[] message)
Str convert.- Parameters:
message- the message- Returns:
- the string
-
getP12FileList
public static List<String> getP12FileList(String path, String ssinRiziv)
Gets the list of P12 files for a specific user (SSIN).- Parameters:
path- the path to the folder containing P12 filesssinRiziv- the ssin of the user- Returns:
- the p12 file list
-
getConfigurationFileList
public static List<String> getConfigurationFileList(String path, String configName)
-
toByteArray
public static byte[] toByteArray(InputStream input) throws IOException
Get the contents of anInputStreamas abyte[].This method buffers the input internally, so there is no need to use a
BufferedInputStream.- Parameters:
input- theInputStreamto read from- Returns:
- the requested byte array
- Throws:
NullPointerException- if the input is nullIOException- if an I/O error occurs
-
copy
public static int copy(InputStream input, OutputStream output) throws IOException
Copy bytes from anInputStreamto anOutputStream.This method buffers the input internally, so there is no need to use a
BufferedInputStream.Large streams (over 2GB) will return a bytes copied value of
-1after the copy has completed since the correct number of bytes cannot be returned as an int. For large streams use thecopyLarge(InputStream, OutputStream)method.- Parameters:
input- theInputStreamto read fromoutput- theOutputStreamto write to- Returns:
- the number of bytes copied, or -1 if > Integer.MAX_VALUE
- Throws:
NullPointerException- if the input or output is nullIOException- if an I/O error occurs- Since:
- 1.1
-
copyLarge
public static long copyLarge(InputStream input, OutputStream output) throws IOException
- Throws:
IOException
-
copyLarge
public static long copyLarge(InputStream input, OutputStream output, byte[] buffer) throws IOException
- Throws:
IOException
-
-