MCPcopy Index your code
hub / github.com/dianping/cat / writeTo

Method writeTo

lib/java/src/main/java/com/dianping/cat/util/Files.java:216–234  ·  view source on GitHub ↗
(File file, byte[] data)

Source from the content-addressed store, hash-verified

214 }
215
216 public void writeTo(File file, byte[] data) throws IOException {
217 if (file.isDirectory()) {
218 throw new IOException(String.format("Can't write to an existing directory(%s)", file));
219 }
220
221 Dir.INSTANCE.createDir(file.getParentFile());
222
223 FileOutputStream fos = new FileOutputStream(file);
224
225 try {
226 fos.write(data);
227 } finally {
228 try {
229 fos.close();
230 } catch (IOException e) {
231 // ignore it
232 }
233 }
234 }
235
236 public void writeTo(File file, String data) throws IOException {
237 writeTo(file, data, "utf-8");

Callers

nothing calls this directly

Calls 5

createDirMethod · 0.80
closeMethod · 0.65
getBytesMethod · 0.65
formatMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected