From 611770fa1f6de02569bc93d87fd52f224216622d Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Sun, 8 Nov 2015 15:53:25 +0100 Subject: [PATCH] Added bytereturn for file --- src/zutil/io/file/FileUtil.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) mode change 100644 => 100755 src/zutil/io/file/FileUtil.java diff --git a/src/zutil/io/file/FileUtil.java b/src/zutil/io/file/FileUtil.java old mode 100644 new mode 100755 index 44423af..c732c30 --- a/src/zutil/io/file/FileUtil.java +++ b/src/zutil/io/file/FileUtil.java @@ -120,36 +120,39 @@ public class FileUtil { /** * Reads and returns the content of a file as a String. - * Or use FileUtils.readFileToString(file); - * + * * @param file * @return the file content */ public static String getContent(File file) throws IOException{ - InputStream in = new FileInputStream(file); - String data = new String(IOUtil.getContent( in )); - in.close(); - return data; + return new String(getByteContent(file)); + } + public static byte[] getByteContent(File file) throws IOException { + InputStream in = new FileInputStream(file); + byte[] data = IOUtil.getContent(in); + in.close(); + return data; } /** * Reads and returns the content of a file as a String. - * Or use FileUtils.readFileToString(file); - * + * * @param url * @return the file content */ public static String getContent(URL url) throws IOException{ InputStream in = url.openStream(); - String data = new String(IOUtil.getContent( in )); + String data = new String(IOUtil.getContent(in)); in.close(); return data; } + /** * Cache for the search functions */ private static HashMap> search_cache = new HashMap>(); + /** * An Cache Item class to identify different cached items * @author Ziver