| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * (a) forwards all its output to a target stream |
| | | * (b) keeps track of how many bytes have been written. |
| | | */ |
| | | class MeteredStream extends OutputStream |
| | | public final class MeteredStream extends OutputStream |
| | | { |
| | | OutputStream out; |
| | | long written; |
| | |
| | | * @param out The target output stream to keep track of. |
| | | * @param written The number of bytes written to the stream. |
| | | */ |
| | | MeteredStream(OutputStream out, long written) |
| | | public MeteredStream(OutputStream out, long written) |
| | | { |
| | | this.out = out; |
| | | this.written = written; |
| | |
| | | { |
| | | out.close(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of bytes written in this stream. |
| | | * |
| | | * @return the number of bytes |
| | | */ |
| | | public long getBytesWritten() |
| | | { |
| | | return written; |
| | | } |
| | | } |
| | | |