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; 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 * Cache for the search functions

View file

@ -162,9 +162,11 @@ public class JSONObjectInputStream extends InputStream implements ObjectInput, C
Map map = (Map)type.newInstance(); Map map = (Map)type.newInstance();
for(Iterator<String> it=json.keyIterator(); it.hasNext();){ for(Iterator<String> it=json.keyIterator(); it.hasNext();){
String subKey = it.next(); String subKey = it.next();
map.put( if(json.get(subKey) != null) {
subKey, map.put(
readType((genType.length>=2? genType[1] : null), null, subKey, json.get(subKey))); subKey,
readType((genType.length >= 2 ? genType[1] : null), null, subKey, json.get(subKey)));
}
} }
return map; return map;
} }