From 4a027fab5fa4ec4665ec85f030ed7629ba091d84 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Fri, 20 Nov 2015 16:09:07 +0100 Subject: [PATCH] Added setContent method --- src/zutil/io/file/FileUtil.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/zutil/io/file/FileUtil.java b/src/zutil/io/file/FileUtil.java index c732c30..b997c0f 100755 --- a/src/zutil/io/file/FileUtil.java +++ b/src/zutil/io/file/FileUtil.java @@ -147,6 +147,17 @@ public class FileUtil { return data; } + /** + * Replaces the contents of a file with the specified data. + * + * @param file the file to write the data to + * @param data the data to write to the file + */ + public static void setContent(File file, byte[] data) throws IOException{ + OutputStream out = new FileOutputStream(file); + out.write(data); + out.close(); + } /** * Cache for the search functions