|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.jboss.remoting.transport.multiplex.MultiplexingOutputStream
public class MultiplexingOutputStream
MultiplexingOutputStream
is the class returned by
VirtualSocket.getOutputStream()
.
It supports the methods and behavior implemented by the OutputStream
returned by
java.net.Socket.getOutputStream()
. For more information about the behavior
of the methods, see the javadoc for java.io.OutputStream
.
Copyright (c) 2005
Field Summary | |
---|---|
protected static org.jboss.logging.Logger |
log
|
Constructor Summary | |
---|---|
MultiplexingOutputStream(MultiplexingManager manager,
SocketId socketId)
|
|
MultiplexingOutputStream(MultiplexingManager manager,
VirtualSocket virtualSocket,
SocketId socketId)
|
Method Summary | |
---|---|
protected void |
checkStatus()
Determines how to handle a write request depending on what this socket knows about the state of the peer socket. |
void |
close()
See superclass javadoc. |
void |
flush()
See superclass javadoc. |
protected void |
handleRemoteDisconnect()
|
protected void |
setWriteException(java.io.IOException e)
|
protected void |
shutdown()
|
void |
write(byte[] array)
See superclass javadoc. |
void |
write(byte[] array,
int off,
int len)
See superclass javadoc. |
void |
write(int i)
See superclass javadoc. |
protected void |
write(int i,
int brackets)
|
void |
writeInt(int i)
writeInt() is borrowed from DataOutputStream . |
protected void |
writeInt(int i,
int brackets)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.jboss.logging.Logger log
Constructor Detail |
---|
public MultiplexingOutputStream(MultiplexingManager manager, SocketId socketId)
manager
- socketId
- public MultiplexingOutputStream(MultiplexingManager manager, VirtualSocket virtualSocket, SocketId socketId)
manager
- virtualSocket
- socketId
- Method Detail |
---|
public void close() throws java.io.IOException
close
in interface java.io.Closeable
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
public void write(int i) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] array) throws java.io.IOException, java.lang.NullPointerException
write
in class java.io.OutputStream
java.io.IOException
java.lang.NullPointerException
public void write(byte[] array, int off, int len) throws java.io.IOException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException
write
in class java.io.OutputStream
java.io.IOException
java.lang.NullPointerException
java.lang.IndexOutOfBoundsException
protected void setWriteException(java.io.IOException e)
public void writeInt(int i) throws java.io.IOException
writeInt()
is borrowed from DataOutputStream
.
It saves the extra expense of creating a DataOutputStream
.
i
-
java.io.IOException
protected void checkStatus() throws java.io.IOException
Once this socket knows that the peer socket has closed, no more write requests will be honored. There seem to be two ways for a socket A to learn that its peer socket B has closed.
Java seems to respond differently to the two cases. The first write after this socket has learned of the peer's closing through the first scenario will result in a SocketException("Connection reset"). In the second scenario, the first write by this socket after the peer has closed will quietly fail (no exception is thrown). All subsequent writes after either of these two scenarios will result in a SocketException("Broken pipe").
Currently, MultiplexingOutputStream implements only a simplified version of this behavior. In particular, it allows in all cases one write to silently fail, after which all writes result in a SocketException("Broken pipe");
Note. This discussion is based on empirical observation on a linux system, not on examination of code. Your mileage may vary.
java.io.IOException
protected void handleRemoteDisconnect()
protected void shutdown()
protected void write(int i, int brackets) throws java.io.IOException
i
- brackets
-
java.io.IOException
protected void writeInt(int i, int brackets) throws java.io.IOException
i
- brackets
-
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |