public class ChannelOutputStream extends OutputStream
Modifier and Type | Field and Description |
---|---|
protected StreamSinkChannel |
channel |
protected boolean |
closed |
protected long |
timeout |
Constructor and Description |
---|
ChannelOutputStream(StreamSinkChannel channel)
Construct a new instance.
|
ChannelOutputStream(StreamSinkChannel channel,
long timeout,
TimeUnit unit)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
long |
getWriteTimeout(TimeUnit unit)
Get the write timeout.
|
void |
setWriteTimeout(long timeout,
TimeUnit unit)
Set the write timeout.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected final StreamSinkChannel channel
protected volatile boolean closed
protected volatile long timeout
public ChannelOutputStream(StreamSinkChannel channel)
channel
- the channel to wrappublic ChannelOutputStream(StreamSinkChannel channel, long timeout, TimeUnit unit)
channel
- the channel to wraptimeout
- the write timeoutunit
- the write timeout unitspublic long getWriteTimeout(TimeUnit unit)
unit
- the time unitpublic void setWriteTimeout(long timeout, TimeUnit unit)
timeout
- the write timeout, or 0 for noneunit
- the time unitpublic void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.