Package com.helger.commons.io.stream
Class CountingFileOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FileOutputStream
-
- com.helger.commons.io.stream.CountingFileOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class CountingFileOutputStream extends FileOutputStream
A specialFileOutputStreamsub class that keeps track of all written bytes for the statistics handler.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static EAppendDEFAULT_APPENDBy default append is enabled
-
Constructor Summary
Constructors Constructor Description CountingFileOutputStream(File aFile)CountingFileOutputStream(File aFile, EAppend eAppend)CountingFileOutputStream(String sFilename)CountingFileOutputStream(String sFilename, EAppend eAppend)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetBytesWritten()StringtoString()voidwrite(byte[] b)voidwrite(byte[] b, int nOffset, int nLength)voidwrite(int b)-
Methods inherited from class java.io.FileOutputStream
close, finalize, getChannel, getFD
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Field Detail
-
DEFAULT_APPEND
public static final EAppend DEFAULT_APPEND
By default append is enabled
-
-
Constructor Detail
-
CountingFileOutputStream
public CountingFileOutputStream(@Nonnull File aFile) throws FileNotFoundException
- Throws:
FileNotFoundException
-
CountingFileOutputStream
public CountingFileOutputStream(@Nonnull File aFile, @Nonnull EAppend eAppend) throws FileNotFoundException
- Throws:
FileNotFoundException
-
CountingFileOutputStream
public CountingFileOutputStream(@Nonnull String sFilename) throws FileNotFoundException
- Throws:
FileNotFoundException
-
CountingFileOutputStream
public CountingFileOutputStream(@Nonnull String sFilename, @Nonnull EAppend eAppend) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-
Method Detail
-
write
public void write(int b) throws IOException- Overrides:
writein classFileOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classFileOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int nOffset, int nLength) throws IOException- Overrides:
writein classFileOutputStream- Throws:
IOException
-
getBytesWritten
@Nonnegative public long getBytesWritten()
-
-