Class IOUtils

java.lang.Object
org.sejda.commons.util.IOUtils

public final class IOUtils extends Object
Utility class with I/O related static methods
  • Method Details

    • close

      public static void close(Closeable closeable) throws IOException
      Null safe close of the given Closeable.
      Parameters:
      closeable - to be closed
      Throws:
      IOException
    • closeQuietly

      public static void closeQuietly(Closeable closeable)
      Null safe close of the given Closeable suppressing any exception.
      Parameters:
      closeable - to be closed
    • closeQuietly

      public static void closeQuietly(Closeable closeable, Consumer<IOException> consumer)
      Null safe close of the given Closeable handing the potential exception to the given consumer
      Parameters:
      closeable - to be closed
      consumer - consumer for the potential Exception. If null the exception is logged as a warning.
    • toByteArray

      public static byte[] toByteArray(InputStream input) throws IOException
      Parameters:
      input -
      Returns:
      the content of the input stream as a byte[]
      Throws:
      IOException
    • copy

      public static void copy(InputStream input, OutputStream output) throws IOException
      Copy the input stream data to the output stream
      Parameters:
      input -
      output -
      Throws:
      IOException