com.sun.jini.jeri.internal.mux
Class Session.MuxOutputStream
java.lang.Object
java.io.OutputStream
com.sun.jini.jeri.internal.mux.Session.MuxOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- Enclosing class:
- Session
private class Session.MuxOutputStream
- extends OutputStream
Output stream returned by OutboundRequests and InboundRequests for
a session of a multiplexed connection.
Method Summary |
void |
close()
|
private void |
ensureOpen()
This method must ONLY be invoked while synchronized on
this session's lock. |
void |
flush()
|
private void |
waitForIO(IOFuture future)
This method must NOT be invoked while synchronized on
this session's lock. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
private boolean |
writeBuffer(boolean closeIfComplete)
Writes as much of the contents of this stream's output buffer
as is allowed by the current output ration. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buffer
private ByteBuffer buffer
Session.MuxOutputStream
Session.MuxOutputStream()
write
public void write(int b)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
ensureOpen
private void ensureOpen()
throws IOException
- This method must ONLY be invoked while synchronized on
this session's lock.
- Throws:
IOException
writeBuffer
private boolean writeBuffer(boolean closeIfComplete)
throws IOException
- Writes as much of the contents of this stream's output buffer
as is allowed by the current output ration. Upon normal return,
at least one byte will have been transferred from the buffer to
the multiplexed connection output queue, and the buffer will have
been compacted, ready to be filled at the current position.
Returns true if closeIfComplete and session was marked EOF (with
complete buffer written); if true, stream's output buffer should
no longer be accessed (because this method will not wait for
actual writing of the message).
- Throws:
IOException
waitForIO
private void waitForIO(IOFuture future)
throws IOException
- This method must NOT be invoked while synchronized on
this session's lock.
- Throws:
IOException
Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.