Package com.caucho.hessian.mux
Class MuxOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.caucho.hessian.mux.MuxOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class MuxOutputStream extends OutputStream
Output stream to a specific channel.
-
-
Constructor Summary
Constructors Constructor Description MuxOutputStream()Null argument constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Complete writing to the stream, closing the channel.voidflush()Flush data to the output stream.intgetChannel()Gets the channel of the connection.protected OutputStreamgetOutputStream()Gets the raw output stream.protected voidinit(MuxServer server, int channel)Initialize the multiplexor with input and output streams.voidwrite(byte[] buffer, int offset, int length)Writes data to the output stream.voidwrite(int ch)Writes a data byte to the output stream.voidwriteURL(String url)Writes a URL to the stream.protected voidwriteUTF(int code, String string)Writes a UTF-8 string.voidyield()Flush data to the output stream.-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Method Detail
-
init
protected void init(MuxServer server, int channel) throws IOException
Initialize the multiplexor with input and output streams.- Throws:
IOException
-
getOutputStream
protected OutputStream getOutputStream() throws IOException
Gets the raw output stream. Clients will normally not call this.- Throws:
IOException
-
getChannel
public int getChannel()
Gets the channel of the connection.
-
writeURL
public void writeURL(String url) throws IOException
Writes a URL to the stream.- Throws:
IOException
-
write
public void write(int ch) throws IOExceptionWrites a data byte to the output stream.- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] buffer, int offset, int length) throws IOExceptionWrites data to the output stream.- Overrides:
writein classOutputStream- Throws:
IOException
-
yield
public void yield() throws IOExceptionFlush data to the output stream.- Throws:
IOException
-
flush
public void flush() throws IOExceptionFlush data to the output stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOExceptionComplete writing to the stream, closing the channel.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
writeUTF
protected void writeUTF(int code, String string) throws IOExceptionWrites a UTF-8 string.- Parameters:
code- the HMUX code identifying the stringstring- the string to write- Throws:
IOException
-
-