inputStream.close();
writer.close();
// The content is minimized, but can still be (GZip) compressed.
StreamableResource output = new StreamableResourceImpl(input.getContentType(), CompressionStatus.COMPRESSABLE,
input.getLastModified(), new BytestreamCache(bos));
long elapsedNanos = System.nanoTime() - startNanos;
if (logger.isDebugEnabled())
{
double elapsedMillis = ((double) elapsedNanos) * NANOS_TO_MILLIS;
logger.debug(String.format("Minimized %,d input bytes of %s to %,d output bytes in %.2f ms",
input.getSize(), resourceType, output.getSize(), elapsedMillis));
}
return output;
}