Package org.jline.utils
Class FastBufferedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.jline.utils.FastBufferedOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
FastBufferedOutputStream
A simple, non-synchronized buffered output stream for improved performance.
The FastBufferedOutputStream class provides a buffered output stream implementation that improves performance by reducing the number of calls to the underlying output stream. Unlike the standard BufferedOutputStream, this implementation does not include synchronization, making it faster but not thread-safe.
This class is particularly useful in single-threaded contexts where the overhead of synchronization is unnecessary. It uses a fixed-size buffer (8192 bytes) to collect written data before flushing it to the underlying output stream.
Key features include:
- No synchronization overhead for improved performance
- Fixed-size buffer to reduce system calls
- Compatible with the standard OutputStream API
Note that this class is not thread-safe and should not be used in multi-threaded contexts without external synchronization.
-
Field Summary
FieldsFields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterOutputStream
close, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
buf
protected final byte[] buf -
count
protected int count
-
-
Constructor Details
-
FastBufferedOutputStream
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
-