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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -162,10 +162,12 @@ 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();
|
||||
if(json.get(subKey) != null) {
|
||||
map.put(
|
||||
subKey,
|
||||
readType((genType.length >= 2 ? genType[1] : null), null, subKey, json.get(subKey)));
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
// Field is a new Object
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue