Top Description Fields Constructors Methods
org.apache.commons.compress.utils

public Class CountingOutputStream

extends FilterOutputStream
Class Inheritance
Annotations
@Deprecated
Imports
java.io.FilterOutputStream, .IOException, .OutputStream

Deprecated

Use org.apache.commons.io.output.CountingOutputStream.

Stream that tracks the number of bytes read.
Since
1.3

Field Summary

Modifier and TypeField and Description
private long
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
count(final long
the number of bytes written
written
)

Increments the counter of already written bytes.

public long

Returns:

the number of written bytes
getBytesWritten
()

Returns the current number of bytes written to this stream.

public void
write(final byte[]
the data to be written.
b
)

Overrides java.io.FilterOutputStream.write.

Writes b.length bytes to this output stream.
public void
write(final byte[]
the data.
b
,
final int
the start offset in the data.
off
,
final int
the number of bytes to write.
len
)

Overrides java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public void
write(final int
the byte.
b
)

Overrides java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.
Inherited from java.io.FilterOutputStream:
closeflush

Field Detail

bytesWrittenback to summary
private long bytesWritten

Constructor Detail

CountingOutputStreamback to summary
public CountingOutputStream(final OutputStream out)

Method Detail

countback to summary
protected void count(final long written)

Increments the counter of already written bytes. Doesn't increment if the EOF has been hit (written == -1)

Parameters
written:long

the number of bytes written

getBytesWrittenback to summary
public long getBytesWritten()

Returns the current number of bytes written to this stream.

Returns:long

the number of written bytes

writeback to summary
public void write(final byte[] b) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes b.length bytes to this output stream.

Parameters
b:byte[]

the data to be written.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(final byte[] b, final int off, final int len) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
writeback to summary
public void write(final int b) throws IOException

Overrides java.io.FilterOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.

The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b).

Implements the abstract write method of OutputStream.

Parameters
b:int

the byte.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.