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

Method installMyGnuPlot

src/tools/GnuplotInstaller.java:78–105  ·  view source on GitHub ↗

Installs the mygnuplot shell file

()

Source from the content-addressed store, hash-verified

76 * Installs the mygnuplot shell file
77 */
78 public static void installMyGnuPlot() {
79 if(!FOUND_GP) {
80 LOG.warn("Skipping Gnuplot Shell Script Install since Gnuplot executable was not found");
81 return;
82 }
83 if(!GP_FILE.exists()) {
84 if(!GP_FILE.getParentFile().exists()) {
85 GP_FILE.getParentFile().mkdirs();
86 }
87 InputStream is = null;
88 FileOutputStream fos = null;
89 try {
90 is = GnuplotInstaller.class.getClassLoader().getResourceAsStream(GP_BATCH_FILE_NAME);
91 ChannelBuffer buff = new DynamicChannelBuffer(is.available());
92 buff.writeBytes(is, is.available());
93 is.close(); is = null;
94 fos = new FileOutputStream(GP_FILE);
95 buff.readBytes(fos, buff.readableBytes());
96 fos.close(); fos = null;
97 GP_FILE.setExecutable(true);
98 } catch (Exception ex) {
99 throw new IllegalArgumentException("Failed to install mygnuplot", ex);
100 } finally {
101 if( is!=null ) try { is.close(); } catch (Exception x) { /* No Op */ }
102 if( fos!=null ) try { fos.close(); } catch (Exception x) { /* No Op */ }
103 }
104 }
105 }
106
107
108}

Callers 1

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected