Merge branch 'master' of http://repo.koc.se/zutil-java
This commit is contained in:
commit
6dbc31b521
2 changed files with 16 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue