Package org.bouncycastle.util.io
Class BufferingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.bouncycastle.util.io.BufferingOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class BufferingOutputStream extends OutputStream
An output stream that buffers data to be feed into an encapsulated output stream.The stream zeroes out the internal buffer on each flush.
-
-
Constructor Summary
Constructors Constructor Description BufferingOutputStream(OutputStream other)
Create a buffering stream with the default buffer size (4096).BufferingOutputStream(OutputStream other, int bufferSize)
Create a buffering stream with a specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
Flush the internal buffer to the encapsulated output stream.void
write(byte[] bytes, int offset, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
BufferingOutputStream
public BufferingOutputStream(OutputStream other)
Create a buffering stream with the default buffer size (4096).- Parameters:
other
- output stream to be wrapped.
-
BufferingOutputStream
public BufferingOutputStream(OutputStream other, int bufferSize)
Create a buffering stream with a specified buffer size.- Parameters:
other
- output stream to be wrapped.bufferSize
- size in bytes for internal buffer.
-
-
Method Detail
-
write
public void write(byte[] bytes, int offset, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
Flush the internal buffer to the encapsulated output stream. Zero the buffer contents when done.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- on error.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-