Class IOHelper


  • public class IOHelper
    extends Object
    Contains helper methods for IO handling
    • Constructor Detail

      • IOHelper

        public IOHelper()
    • Method Detail

      • close

        public static void close​(Closeable... closeables)
        Closes the given Closeables, ignoring any exceptions
      • close

        public static void close​(Closeable closeable)
        Closes the given Closeable, ignoring any exceptions
      • parseFileSize

        public static long parseFileSize​(String fileSize)
        Parses the given file size string into the number of bytes. It's accepted a floating point number followed by either G, GB, M, MB, K, KB, B or with no suffix. Throws IllegalArgumentException if the input doesn't match
      • readBytesAndClose

        public static byte[] readBytesAndClose​(InputStream in)
                                        throws IOException
        Reads all bytes in the given input stream, closing it before returning
        Throws:
        IOException
      • readContentAndClose

        public static String readContentAndClose​(Reader in)
                                          throws IOException
        Reads the entire contents of the given reader as string, closing the reader
        Throws:
        IOException