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 ReadOnlyBufferException
s or BufferOverflowException
s thrown by the underlying
ByteBuffer
will be wrapped in an IOException
and rethrown.
Instances are thread safe.
-
Field Summary
-
Constructor Summary
-
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
- ifbuf
is null
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-