Class ByteCountOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- fr.ens.biologie.genomique.eoulsan.io.ByteCountOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class ByteCountOutputStream extends FilterOutputStream
This class define a filter that count the number of written bytes by an InputStream.- Since:
- 1.0
- Author:
- Laurent Jourdren
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description ByteCountOutputStream(OutputStream os)
Public constructor.ByteCountOutputStream(OutputStream os, long attemptedNWritten)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
long
getBytesNumberWritten()
Get the number of bytes written.void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.FilterOutputStream
flush
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
ByteCountOutputStream
public ByteCountOutputStream(OutputStream os)
Public constructor.- Parameters:
os
- output stream
-
ByteCountOutputStream
public ByteCountOutputStream(OutputStream os, long attemptedNWritten)
Public constructor.- Parameters:
os
- output stream
-
-
Method Detail
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
getBytesNumberWritten
public long getBytesNumberWritten()
Get the number of bytes written.- Returns:
- the number of bytes written
-
-