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 diff --git a/src/zutil/parser/json/JSONObjectInputStream.java b/src/zutil/parser/json/JSONObjectInputStream.java index b40af53..6114457 100755 --- a/src/zutil/parser/json/JSONObjectInputStream.java +++ b/src/zutil/parser/json/JSONObjectInputStream.java @@ -162,9 +162,11 @@ public class JSONObjectInputStream extends InputStream implements ObjectInput, C Map map = (Map)type.newInstance(); for(Iterator it=json.keyIterator(); it.hasNext();){ String subKey = it.next(); - map.put( - subKey, - readType((genType.length>=2? genType[1] : null), null, subKey, json.get(subKey))); + if(json.get(subKey) != null) { + map.put( + subKey, + readType((genType.length >= 2 ? genType[1] : null), null, subKey, json.get(subKey))); + } } return map; }