be.fgov.ehealth.etee.crypto.utils

## Class IoUtils

- java.lang.Object
- - be.fgov.ehealth.etee.crypto.utils.IoUtils

-     public final class IoUtils
      extends java.lang.Object

  Class grouping useful IO operations.

  To limit the dependencies of eHealth's Crypto lib these operations were put here, in stead of adding a dependency to a library like Spring.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.io.FileInputStream` | `openFileInputStream(java.lang.String pathname)` Opens an InputStream to a file.
    `static java.io.FileOutputStream` | `openFileOutputStream(java.lang.String pathname)` Opens an OutputStream to a file.
    `static byte[]` | `readFile(java.lang.String pathname)` Reads the data of a file into a byte[].
    `static java.io.File` | `writeToFile(byte[] data, java.lang.String pathname)` Writes data to a file with the given pathname.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### writeToFile

          public static java.io.File writeToFile(byte[] data,
                                                 java.lang.String pathname)

      Writes data to a file with the given pathname. 'Checked' IOExceptions are transformed to 'unchecked' RuntimeExceptions for convenience.
      Parameters:
        `data` - the data to write
        `pathname` - the path to the output file
      Returns:
        File

    - #### readFile

          public static byte[] readFile(java.lang.String pathname)

      Reads the data of a file into a byte[]. 'Checked' IOExceptions are transformed to 'unchecked' RuntimeExceptions for convenience.
      Parameters:
        `pathname` - path of the file to read.
      Returns:
        byte array of the data read.

    - #### openFileInputStream

          public static java.io.FileInputStream openFileInputStream(java.lang.String pathname)

      Opens an InputStream to a file. 'Checked' FileNotFoundException are transformed to 'unchecked' RuntimeExceptions for convenience.
      Parameters:
        `pathname` - path of the file to read.
      Returns:
        FileInputStream to the file.

    - #### openFileOutputStream

          public static java.io.FileOutputStream openFileOutputStream(java.lang.String pathname)

      Opens an OutputStream to a file. 'Checked' FileNotFoundException are transformed to 'unchecked' RuntimeExceptions for convenience.
      Parameters:
        `pathname` - path of the file to write to.
      Returns:
        FileOutputStream to the file

Copyright © 2025 eHealth. All rights reserved.