Class IOUtils


  • public class IOUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      IOUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void cleanup​(org.slf4j.Logger log, java.io.Closeable... closeables)
      Close the Closeable objects and ignore any IOException or null pointers.
      static void closeStream​(java.io.Closeable stream)
      Closes the stream ignoring IOException.
      static void copyBytes​(java.io.InputStream in, java.io.OutputStream out, int buffSize)
      Copies from one stream to another.
      static void copyBytes​(java.io.InputStream in, java.io.OutputStream out, int buffSize, boolean close)
      Copies from one stream to another.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IOUtils

        public IOUtils()
    • Method Detail

      • closeStream

        public static void closeStream​(java.io.Closeable stream)
        Closes the stream ignoring IOException. Must only be called in cleaning up from exception handlers.
        Parameters:
        stream - the Stream to close
      • cleanup

        public static void cleanup​(org.slf4j.Logger log,
                                   java.io.Closeable... closeables)
        Close the Closeable objects and ignore any IOException or null pointers. Must only be used for cleanup in exception handlers.
        Parameters:
        log - the log to record problems to at debug level. Can be null.
        closeables - the objects to close
      • copyBytes

        public static void copyBytes​(java.io.InputStream in,
                                     java.io.OutputStream out,
                                     int buffSize,
                                     boolean close)
                              throws java.io.IOException
        Copies from one stream to another.
        Parameters:
        in - InputStrem to read from
        out - OutputStream to write to
        buffSize - the size of the buffer
        close - whether or not close the InputStream and OutputStream at the end. The streams are closed in the finally clause.
        Throws:
        java.io.IOException
      • copyBytes

        public static void copyBytes​(java.io.InputStream in,
                                     java.io.OutputStream out,
                                     int buffSize)
                              throws java.io.IOException
        Copies from one stream to another.
        Parameters:
        in - InputStrem to read from
        out - OutputStream to write to
        buffSize - the size of the buffer
        Throws:
        java.io.IOException