Class IOUtils

java.lang.Object
be.personify.util.io.IOUtils

public class IOUtils extends Object
Utility class for IO
Author:
vanderw
  • Field Details

  • Constructor Details

    • IOUtils

      public IOUtils()
  • Method Details

    • 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
    • zip

      public static void zip(String sourceDirPath, String zipFilePath) throws IOException
      Throws:
      IOException
    • humanReadableByteCountBin

      public static String humanReadableByteCountBin(long bytes)