Search in sources :

Example 1 with BestCompressionGZIPOutputStream

use of com.facebook.buck.util.BestCompressionGZIPOutputStream in project buck by facebook.

the class ChromeTraceBuildListener method createPathAndStream.

private TracePathAndStream createPathAndStream(InvocationInfo invocationInfo) {
    String filenameTime = dateFormat.get().format(new Date(clock.currentTimeMillis()));
    String traceName = String.format("build.%s.%s.trace", filenameTime, invocationInfo.getBuildId());
    if (compressTraces) {
        traceName = traceName + ".gz";
    }
    Path tracePath = invocationInfo.getLogDirectoryPath().resolve(traceName);
    try {
        projectFilesystem.createParentDirs(tracePath);
        OutputStream stream = projectFilesystem.newFileOutputStream(tracePath);
        if (compressTraces) {
            stream = new BestCompressionGZIPOutputStream(stream, true);
        }
        return new TracePathAndStream(tracePath, stream);
    } catch (IOException e) {
        throw new HumanReadableException(e, "Unable to write trace file: " + e);
    }
}
Also used : Path(java.nio.file.Path) HumanReadableException(com.facebook.buck.util.HumanReadableException) BestCompressionGZIPOutputStream(com.facebook.buck.util.BestCompressionGZIPOutputStream) OutputStream(java.io.OutputStream) IOException(java.io.IOException) BestCompressionGZIPOutputStream(com.facebook.buck.util.BestCompressionGZIPOutputStream) Date(java.util.Date)

Example 2 with BestCompressionGZIPOutputStream

use of com.facebook.buck.util.BestCompressionGZIPOutputStream in project buck by facebook.

the class CompressingFileHandler method setOutputStream.

@Override
protected synchronized void setOutputStream(OutputStream out) throws SecurityException {
    OutputStream stream;
    try {
        stream = new BestCompressionGZIPOutputStream(out, true);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    super.setOutputStream(stream);
}
Also used : OutputStream(java.io.OutputStream) BestCompressionGZIPOutputStream(com.facebook.buck.util.BestCompressionGZIPOutputStream) IOException(java.io.IOException) BestCompressionGZIPOutputStream(com.facebook.buck.util.BestCompressionGZIPOutputStream)

Aggregations

BestCompressionGZIPOutputStream (com.facebook.buck.util.BestCompressionGZIPOutputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 HumanReadableException (com.facebook.buck.util.HumanReadableException)1 Path (java.nio.file.Path)1 Date (java.util.Date)1