Package org.dellroad.stuff.io
Class ByteBufferOutputStream
java.lang.Object
java.io.OutputStream
org.dellroad.stuff.io.ByteBufferOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Provides an
OutputStream view of a ByteBuffer.
Any ReadOnlyBufferExceptions or BufferOverflowExceptions thrown by the underlying
ByteBuffer will be wrapped in an IOException and rethrown.
Instances are thread safe.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
buf
The underlyingByteBuffer.
-
-
Constructor Details
-
ByteBufferOutputStream
Constructor.- Parameters:
buf- buffer- Throws:
IllegalArgumentException- ifbufis null
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-