public boolean load() { if (this.where.isFile() && this.where.length() > 1) { try { data = codec.dec().from(this.where).get(Data.class); loaded = true; return true; } catch (Exception e) { throw new RuntimeException("Cannot read settings file " + this.where, e); } } if (!data.map.containsKey("name")) data.map.put("name", System.getProperty("user.name")); return false; }
public Info(File content, URI url) throws Exception { this.file = content; this.url = url; this.jsonFile = new File(content.getParentFile(), content.getName() + ".json"); if (this.jsonFile.isFile()) { try { this.dto = codec.dec() .from(jsonFile) .get(InfoDTO.class); } catch (Exception e) { this.dto = new InfoDTO(); logger.error("URLCache Failed to load data for {} from {}", content, jsonFile); } } else { this.dto = new InfoDTO(); } this.dto.uri = url; }
public Info(File content, URI url) throws Exception { this.file = content; this.url = url; this.jsonFile = new File(content.getParentFile(), content.getName() + ".json"); if (this.jsonFile.isFile()) { try { this.dto = codec.dec() .from(jsonFile) .get(InfoDTO.class); } catch (Exception e) { this.dto = new InfoDTO(); logger.error("URLCache Failed to load data for {} from {}", content, jsonFile); } } else { this.dto = new InfoDTO(); } this.dto.uri = url; }
/** * Get the index, load it if necessary * * @return * @throws Exception */ private FileLayout getIndex() throws Exception { if (index != null) return index; if (!indexFile.isFile()) { return index = new FileLayout(); } else return index = codec.dec().from(indexFile).get(FileLayout.class); }
/** * Get the index, load it if necessary * * @throws Exception */ private FileLayout getIndex() throws Exception { if (index != null) return index; if (!indexFile.isFile()) { return index = new FileLayout(); } else return index = codec.dec() .from(indexFile) .get(FileLayout.class); }
/** * Get the index, load it if necessary * * @throws Exception */ private FileLayout getIndex() throws Exception { if (index != null) return index; if (!indexFile.isFile()) { return index = new FileLayout(); } else return index = codec.dec() .from(indexFile) .get(FileLayout.class); }
/** * Get the index, load it if necessary * * @return * @throws Exception */ private FileLayout getIndex() throws Exception { if (index != null) return index; if (!indexFile.isFile()) { return index = new FileLayout(); } else return index = codec.dec().from(indexFile).get(FileLayout.class); }
data = codec.dec().from(in).get(Data.class); loaded = true; return true;
Request request = codec.dec().from(rq.getInputStream()).get(Request.class); try {
data = codec.dec().from(in).get(Data.class); loaded = true; return true;
data = codec.dec() .from(in) .get(Data.class);
data = codec.dec() .from(in) .get(Data.class);
data = codec.dec() .from(in) .get(Data.class);
private Object convert(Type ref, InputStream in) throws IOException, Exception { if (ref instanceof Class) { Class<?> refc = (Class<?>) ref; if (refc == byte[].class) { return IO.read(in); } else if (InputStream.class.isAssignableFrom((refc))) { return in; } else if (String.class == refc) { return IO.collect(in); } } String s = IO.collect(in); return codec.dec() .from(s) .get(ref); }
private Object convert(Type ref, InputStream in) throws IOException, Exception { if (ref instanceof Class) { Class<?> refc = (Class<?>) ref; if (refc == byte[].class) { return IO.read(in); } else if (InputStream.class.isAssignableFrom((refc))) { return in; } else if (String.class == refc) { return IO.collect(in); } } String s = IO.collect(in); return codec.dec() .from(s) .get(ref); }
if (type != null) { Object payload = null; Decoder d = codec.dec().from(rq.getInputStream()); if (!d.isEof()) payload = d.get(type);
final List<Hashtable<String, Object>> list = codec.dec().from(data) .get(new TypeReference<List<Hashtable<String, Object>>>() { });