MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / writeFile

Method writeFile

src/tsd/GraphHandler.java:571–586  ·  view source on GitHub ↗

Writes the given byte array into a file. This function logs an error but doesn't throw if it fails. @param query The query being handled (for logging purposes). @param path The path to write to. @param contents The contents to write into the file.

(final HttpQuery query,
                                final String path,
                                final byte[] contents)

Source from the content-addressed store, hash-verified

569 * @param contents The contents to write into the file.
570 */
571 private static void writeFile(final HttpQuery query,
572 final String path,
573 final byte[] contents) {
574 try {
575 final FileOutputStream out = new FileOutputStream(path);
576 try {
577 out.write(contents);
578 } finally {
579 out.close();
580 }
581 } catch (FileNotFoundException e) {
582 logError(query, "Failed to create file " + path, e);
583 } catch (IOException e) {
584 logError(query, "Failed to write file " + path, e);
585 }
586 }
587
588 /**
589 * Reads a file into a byte array.

Callers 1

executeMethod · 0.80

Calls 3

logErrorMethod · 0.95
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected