This commit is contained in:
Ziver Koc 2015-11-20 21:30:23 +01:00
commit 6dbc31b521
2 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -162,9 +162,11 @@ public class JSONObjectInputStream extends InputStream implements ObjectInput, C
Map map = (Map)type.newInstance();
for(Iterator<String> 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;
}