Class IOUtils


  • public class IOUtils
    extends Object
    The Class IOUtils.
    • Constructor Detail

      • IOUtils

        public IOUtils()
    • 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 IOException
        Compress.
        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 IOException
        Decompress.
        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.
      • 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 files
        ssinRiziv - 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 an InputStream as a byte[].

        This method buffers the input internally, so there is no need to use a BufferedInputStream.

        Parameters:
        input - the InputStream to read from
        Returns:
        the requested byte array
        Throws:
        NullPointerException - if the input is null
        IOException - if an I/O error occurs
      • copy

        public static int copy​(InputStream input,
                               OutputStream output)
                        throws IOException
        Copy bytes from an InputStream to an OutputStream.

        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 -1 after the copy has completed since the correct number of bytes cannot be returned as an int. For large streams use the copyLarge(InputStream, OutputStream) method.

        Parameters:
        input - the InputStream to read from
        output - the OutputStream to write to
        Returns:
        the number of bytes copied, or -1 if > Integer.MAX_VALUE
        Throws:
        NullPointerException - if the input or output is null
        IOException - if an I/O error occurs
        Since:
        1.1