com.caucho.hessian.mux
Class MuxOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.caucho.hessian.mux.MuxOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class MuxOutputStream
extends java.io.OutputStream

Output stream to a specific channel.


Constructor Summary
MuxOutputStream()
          Null argument constructor.
 
Method Summary
 void close()
          Complete writing to the stream, closing the channel.
 void flush()
          Flush data to the output stream.
 int getChannel()
          Gets the channel of the connection.
protected  java.io.OutputStream getOutputStream()
          Gets the raw output stream.
protected  void init(MuxServer server, int channel)
          Initialize the multiplexor with input and output streams.
 void write(byte[] buffer, int offset, int length)
          Writes data to the output stream.
 void write(int ch)
          Writes a data byte to the output stream.
 void writeURL(java.lang.String url)
          Writes a URL to the stream.
protected  void writeUTF(int code, java.lang.String string)
          Writes a UTF-8 string.
 void yield()
          Flush data to the output stream.
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MuxOutputStream

public MuxOutputStream()
Null argument constructor.

Method Detail

init

protected void init(MuxServer server,
                    int channel)
             throws java.io.IOException
Initialize the multiplexor with input and output streams.

Throws:
java.io.IOException

getOutputStream

protected java.io.OutputStream getOutputStream()
                                        throws java.io.IOException
Gets the raw output stream. Clients will normally not call this.

Throws:
java.io.IOException

getChannel

public int getChannel()
Gets the channel of the connection.


writeURL

public void writeURL(java.lang.String url)
              throws java.io.IOException
Writes a URL to the stream.

Throws:
java.io.IOException

write

public void write(int ch)
           throws java.io.IOException
Writes a data byte to the output stream.

Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Writes data to the output stream.

Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

yield

public void yield()
           throws java.io.IOException
Flush data to the output stream.

Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flush data to the output stream.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Complete writing to the stream, closing the channel.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

writeUTF

protected void writeUTF(int code,
                        java.lang.String string)
                 throws java.io.IOException
Writes a UTF-8 string.

Parameters:
code - the HMUX code identifying the string
string - the string to write
Throws:
java.io.IOException