MCPcopy Index your code
hub / github.com/cmu-db/benchbase / save

Method save

src/main/java/com/oltpbenchmark/util/JSONUtil.java:159–174  ·  view source on GitHub ↗

Write the contents of a JSONSerializable object out to a file on the local disk @param @param object @param output_path @throws IOException

(T object, String output_path)

Source from the content-addressed store, hash-verified

157 * @throws IOException
158 */
159 public static <T extends JSONSerializable> void save(T object, String output_path)
160 throws IOException {
161 if (LOG.isDebugEnabled()) {
162 LOG.debug(
163 "Writing out contents of {} to '{}'", object.getClass().getSimpleName(), output_path);
164 }
165 File f = new File(output_path);
166 try {
167 FileUtil.makeDirIfNotExists(f.getParent());
168 String json = object.toJSONString();
169 FileUtil.writeStringToFile(f, format(json));
170 } catch (Exception ex) {
171 LOG.error("Failed to serialize the {} file '{}'", object.getClass().getSimpleName(), f, ex);
172 throw new IOException(ex);
173 }
174 }
175
176 /**
177 * Load in a JSONSerialable stored in a file

Callers 1

saveMethod · 0.95

Calls 5

makeDirIfNotExistsMethod · 0.95
writeStringToFileMethod · 0.95
formatMethod · 0.95
getClassMethod · 0.80
toJSONStringMethod · 0.45

Tested by

no test coverage detected