TrueZIP 6.8.2

de.schlichtherle.io
Class CountingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by de.schlichtherle.io.CountingOutputStream
All Implemented Interfaces:
Closeable, Flushable

final class CountingOutputStream
extends FilterOutputStream

An output stream which logs the number of bytes written.

Since:
TrueZIP 6.5
Version:
$Id: CountingOutputStream.java 06f3ba684701 2010/11/04 01:15:55 christian $
Author:
Christian Schlichtherle

Field Summary
private static boolean reset
           
private static long total
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
CountingOutputStream(OutputStream out)
           
 
Method Summary
(package private) static long getTotal()
          Returns the total number of bytes written.
(package private) static void init()
          Resets the total number of bytes written if resetOnInit() has been called before.
(package private) static void resetOnInit()
          Requests that the total number of bytes written gets reset on the next call to init().
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.FilterOutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

total

private static volatile long total

reset

private static volatile boolean reset
Constructor Detail

CountingOutputStream

CountingOutputStream(OutputStream out)
Method Detail

getTotal

static long getTotal()
Returns the total number of bytes written.


init

static void init()
Resets the total number of bytes written if resetOnInit() has been called before.


resetOnInit

static void resetOnInit()
Requests that the total number of bytes written gets reset on the next call to init().


write

public void write(int b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

TrueZIP 6.8.2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.