Code example for CountingOutputStream

Methods: getCount

0
        Monitors.registerObject(this);
    } 
 
    public void handle(HttpExchange exchange) throws IOException {
        CountingInputStream input = new CountingInputStream(exchange.getRequestBody());
        CountingOutputStream output = new CountingOutputStream(exchange.getResponseBody());
        exchange.setStreams(input, output);
        Stopwatch stopwatch = latency.start();
        try { 
            handleImpl(exchange);
        } finally { 
            stopwatch.stop();
            bytesReceived.increment(input.getCount());
            bytesSent.increment(output.getCount());
        } 
    } 
 
    protected abstract void handleImpl(HttpExchange exchange) throws IOException;
} 
Experience pair programming with AI  Get Codota for Java