|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
com.mucommander.io.CounterOutputStream
public class CounterOutputStream
An OutputStream that keeps track of the number of bytes that have been written to it.
The actual number of bytes can be retrieved from the ByteCounter instance returned by getCounter().
The CounterOutputStream(OutputStream, ByteCounter) constructor can be used to specify an existing
ByteCounter instance instead of creating a new one. The ByteCounter will always remain accessible, even
after this stream has been closed.
ByteCounter| Constructor Summary | |
|---|---|
CounterOutputStream(java.io.OutputStream out)
Creates a new CounterOutputStream using the specified OutputStream. |
|
CounterOutputStream(java.io.OutputStream out,
ByteCounter counter)
Creates a new CounterOutputStream using the specified OutputStream and ByteCounter. |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
flush()
|
ByteCounter |
getCounter()
Returns the ByteCounter that holds the number of bytes that have been written to this OutputStream. |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CounterOutputStream(java.io.OutputStream out)
ByteCounter will be created.
out - the underlying OutputStream the data will be written to
public CounterOutputStream(java.io.OutputStream out,
ByteCounter counter)
ByteCounter.
The provided ByteCounter will NOT be reset, whatever value it contains will be kept.
out - the underlying OutputStream the data will be written to| Method Detail |
|---|
public ByteCounter getCounter()
public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
public void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard