コード例 #1
0
 private static InputStream maybeWrapStatsInputStream(
     InputStream inputStream,
     CompressingFilterContext context,
     CompressingFilterStats.StatsField field) {
   assert inputStream != null;
   InputStream result;
   if (context.isStatsEnabled()) {
     CompressingFilterStats stats = context.getStats();
     CompressingFilterStats.InputStatsCallback callbackInput = stats.getInputStatsCallback(field);
     result = new StatsInputStream(inputStream, callbackInput);
   } else {
     result = inputStream;
   }
   return result;
 }
コード例 #2
0
 private static OutputStream maybeWrapStatsOutputStream(
     OutputStream outputStream,
     CompressingFilterContext context,
     CompressingFilterStats.StatsField field) {
   assert outputStream != null;
   OutputStream result;
   if (context.isStatsEnabled()) {
     CompressingFilterStats stats = context.getStats();
     CompressingFilterStats.OutputStatsCallback callbackOutput =
         stats.getOutputStatsCallback(field);
     result = new StatsOutputStream(outputStream, callbackOutput);
   } else {
     result = outputStream;
   }
   return result;
 }