public class ByteBufferOutput extends java.io.OutputStream implements ByteOutput
OutputStream
implementing ByteOutput
which writes to a ByteBuffer
.Constructor and Description |
---|
ByteBufferOutput(java.nio.ByteBuffer buffer)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
write(byte[] b)
Write all the bytes from the given array to the stream.
|
void |
write(byte[] b,
int off,
int len)
Write some of the bytes from the given array to the stream.
|
void |
write(int b)
Writes to the output stream the eight low-order bits of the argument
b . |
public ByteBufferOutput(java.nio.ByteBuffer buffer)
buffer
- the buffer to write topublic void write(int b) throws java.io.IOException
b
. The 24 high-order bits of
b
are ignored.write
in interface ByteOutput
write
in class java.io.OutputStream
b
- the byte to writejava.io.IOException
- if an error occurspublic void write(byte[] b) throws java.io.IOException
write
in interface ByteOutput
write
in class java.io.OutputStream
b
- the byte arrayjava.io.IOException
- if an error occurspublic void write(byte[] b, int off, int len) throws java.io.IOException
write
in interface ByteOutput
write
in class java.io.OutputStream
b
- the byte arrayoff
- the index to start writing fromlen
- the number of bytes to writejava.io.IOException
- if an error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
Copyright © 2011 JBoss, a division of Red Hat, Inc.