/** * Overwrites a file with the contents of a byte array. * * @param from the bytes to write * @param to the destination file * @throws IOException if an I/O error occurs */ public static void write(byte[] from, File to) throws IOException { ByteStreams.write(from, newOutputStreamSupplier(to)); }
/** * Overwrites a file with the contents of a byte array. * * @param from the bytes to write * @param to the destination file * @throws IOException if an I/O error occurs */ public static void write(byte[] from, File to) throws IOException { ByteStreams.write(from, newOutputStreamSupplier(to)); }
/** * Overwrites a file with the contents of a byte array. * * @param from the bytes to write * @param to the destination file * @throws IOException if an I/O error occurs */ public static void write(byte[] from, File to) throws IOException { ByteStreams.write(from, newOutputStreamSupplier(to)); }
private void maybeWriteInstrumentedCodeToDisk(final boolean separateFile, final URI sourceUri, final String instrumentedCode) { if (config.isOutputInstrumentedFiles() && separateFile) { synchronized (writtenToDisk) { try { if (!writtenToDisk.contains(sourceUri)) { final String parent = UriUtil.getParent(sourceUri); final String fileName = UriUtil.getLastSegmentOrHost(sourceUri); final File fileOutputDir = new File(instrumentedFileDirectory, Hashing.md5().hashString(parent).toString()); FileUtils.mkdir(fileOutputDir.getAbsolutePath()); final File outputFile = new File(fileOutputDir, fileName); logger.info("Writing instrumented file: {}", outputFile.getAbsolutePath()); ByteStreams.write(instrumentedCode.getBytes("UTF-8"), Files.newOutputStreamSupplier(outputFile)); writtenToDisk.add(sourceUri); } } catch (final IOException e) { throw new RuntimeException(e); } } } }
public static void debugByteCode(ClassDefinition classDefinition, PrintWriter writer) { ClassReader reader = new ClassReader(classDefinition.getBytecode()); reader.accept(new CheckClassAdapter(new TraceClassVisitor(writer)), 0); File file = new File("/tmp/" + classDefinition.getInternalName() + ".class"); file.getParentFile().mkdirs(); writer.println(file); writer.flush(); try { ByteStreams.write(classDefinition.getBytecode(), Files.newOutputStreamSupplier(file)); } catch (IOException e) { e.printStackTrace(); } }
public static void debugByteCode(ClassDefinition classDefinition, PrintWriter writer) { ClassReader reader = new ClassReader(classDefinition.getBytecode()); reader.accept(new CheckClassAdapter(new TraceClassVisitor(writer)), 0); File file = new File("/tmp/" + classDefinition.getInternalName() + ".class"); file.getParentFile().mkdirs(); writer.println(file); writer.flush(); try { ByteStreams.write(classDefinition.getBytecode(), Files.newOutputStreamSupplier(file)); } catch (IOException e) { e.printStackTrace(); } }
public static void debugByteCode(ClassDefinition classDefinition, PrintWriter writer) { ClassReader reader = new ClassReader(classDefinition.getBytecode()); reader.accept(new CheckClassAdapter(new TraceClassVisitor(writer)), 0); File file = new File("/tmp/" + classDefinition.getInternalName() + ".class"); file.getParentFile().mkdirs(); writer.println(file); writer.flush(); try { ByteStreams.write(classDefinition.getBytecode(), Files.newOutputStreamSupplier(file)); } catch (IOException e) { e.printStackTrace(); } }
public static void writeFloatMetric( OutputSupplier<? extends OutputStream> outSupplier, String name, CompressedFloatsSupplierSerializer column ) throws IOException { ByteStreams.write(version, outSupplier); serializerUtils.writeString(outSupplier, name); serializerUtils.writeString(outSupplier, "float"); column.closeAndConsolidate(outSupplier); }
ByteStreams.write( "Got no configuration from config helper".getBytes( "utf-8" ), new OutputSupplier<OutputStream>()
ByteStreams.write( "Got no security configuration".getBytes( "utf-8" ), new OutputSupplier<OutputStream>()
ByteStreams.write( "Got no security configuration".getBytes( "utf-8" ), new OutputSupplier<OutputStream>()
final FileSmoosher v9Smoosher = new FileSmoosher(v9Dir); ByteStreams.write(Ints.toByteArray(9), Files.newOutputStreamSupplier(new File(v9Dir, "version.bin"))); Map<String, GenericIndexed<ImmutableConciseSet>> bitmapIndexes = Maps.newHashMap();