Class IOUtils


  • public class IOUtils
    extends Object
    Utility class for IO
    Author:
    vanderw
    • Constructor Detail

      • IOUtils

        public IOUtils()
    • Method Detail

      • readFileAsBytes

        public static byte[] readFileAsBytes​(InputStream inputStream)
                                      throws IOException
        Read a Inputstream
        Parameters:
        inputStream - containign the things to read
        Returns:
        a byte array cintaing the things that are read
        Throws:
        IOException - containing the stacktrace
      • defaultCharset

        public static final Charset defaultCharset()
        Returns the default charset
        Returns:
        the default charset
      • readFileAsBytes

        public static byte[] readFileAsBytes​(Class<?> c,
                                             String fileName)
                                      throws IOException
        Reads a file as bytes
        Parameters:
        c - the class for the getresourceasstream
        fileName - the name of the file
        Returns:
        the byte array containing the things read
        Throws:
        IOException - containing the stacktrace
      • readFileAsLines

        public static String[] readFileAsLines​(String fileName)
      • getIp

        public static String getIp()
        Returns the name/ip
        Returns:
        string containing the hostname/ip of the localhost
      • humanReadableByteCountBin

        public static String humanReadableByteCountBin​(long bytes)