Package be.personify.util.io
Class IOUtils
- java.lang.Object
-
- be.personify.util.io.IOUtils
-
public class IOUtils extends Object
Utility class for IO- Author:
- vanderw
-
-
Field Summary
Fields Modifier and Type Field Description static StringCHARSET_UTF_8static StringLINE_SEPARATOR
-
Constructor Summary
Constructors Constructor Description IOUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CharsetdefaultCharset()Returns the default charsetstatic StringgetIp()Returns the name/ipstatic StringhumanReadableByteCountBin(long bytes)static byte[]readFileAsBytes(InputStream inputStream)Read a Inputstreamstatic byte[]readFileAsBytes(Class<?> c, String fileName)Reads a file as bytesstatic String[]readFileAsLines(String fileName)static voidzip(String sourceDirPath, String zipFilePath)
-
-
-
Field Detail
-
CHARSET_UTF_8
public static final String CHARSET_UTF_8
- See Also:
- Constant Field Values
-
LINE_SEPARATOR
public static final String LINE_SEPARATOR
-
-
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 getresourceasstreamfileName- the name of the file- Returns:
- the byte array containing the things read
- Throws:
IOException- containing the stacktrace
-
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)
-
-