Class IoUtil


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

      Constructors 
      Constructor Description
      IoUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeQuietly​(java.io.Closeable... closeables)  
      static void copyFile​(java.io.File source, java.io.File target)  
      static void copyStream​(java.io.InputStream in, java.io.OutputStream out)  
      static void createDirectory​(java.io.File dir)  
      static java.lang.String getText​(java.io.File path)
      Returns the text read from the given file as a String.
      static java.lang.String getText​(java.io.InputStream stream)
      Returns the text read from the given stream as a String.
      static java.lang.String getText​(java.io.Reader reader)
      Returns the text read from the given reader as a String.
      • Methods inherited from class java.lang.Object

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

      • IoUtil

        public IoUtil()
    • Method Detail

      • closeQuietly

        public static void closeQuietly​(java.io.Closeable... closeables)
      • getText

        public static java.lang.String getText​(java.io.Reader reader)
                                        throws java.io.IOException
        Returns the text read from the given reader as a String. Closes the given reader upon return.
        Throws:
        java.io.IOException
      • getText

        public static java.lang.String getText​(java.io.File path)
                                        throws java.io.IOException
        Returns the text read from the given file as a String.
        Throws:
        java.io.IOException
      • getText

        public static java.lang.String getText​(java.io.InputStream stream)
                                        throws java.io.IOException
        Returns the text read from the given stream as a String. Closes the given stream upon return.
        Throws:
        java.io.IOException
      • createDirectory

        public static void createDirectory​(java.io.File dir)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • copyStream

        public static void copyStream​(java.io.InputStream in,
                                      java.io.OutputStream out)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • copyFile

        public static void copyFile​(java.io.File source,
                                    java.io.File target)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
        Throws:
        java.io.FileNotFoundException
        java.io.IOException