Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

OutputStream Class Reference

Flattens the bitstream going to an MPS server from MPS primitive types. More...

Collaboration diagram for OutputStream:

Collaboration graph
[legend]
List of all members.

Private Methods

public OutputStream (Connection c)
private void setupBuffer ()
public void resetBuffer ()
public OutputStream (java.io.OutputStream o)
private void write (int ch)
private void open () throws MPSException
public void writeint (int i)
public void writestring (String s)
public void writebool (boolean b)
public void writelong (long i)
public void writechar (char ch)
public void writeReference (Object o) throws MPSException
public void writefloat (float f) throws MPSException
public void flush () throws MPSException

Private Attributes

private Connection connection
private java io OutputStream output
private StringBuffer buffer

Detailed Description

Flattens the bitstream going to an MPS server from MPS primitive types.

Uses a Connection object to talk to the other end.

Author(s):
Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
See also:
org.hebe.mps.Connection , org.hebe.mps.InputStream

Definition at line 48 of file OutputStream.java.


Constructor & Destructor Documentation

public OutputStream::OutputStream ( Connection c ) [inline, private]
 

Construct an OutputStream which encodes the bits going to a Connection object.

Parameters:
c   the raw connection to use

Definition at line 59 of file OutputStream.java.

public OutputStream::OutputStream ( java.io.OutputStream o ) [inline, private]
 

Construct an OutputStream which sends bits to an arbitrary inputstream.

Parameters:
o   the raw outputstream to use

Definition at line 84 of file OutputStream.java.


Member Function Documentation

public void OutputStream::flush ( ) [inline, private]
 

Sends the total accumulated buffer of bytes over the connection.

Empties the buffer ready for the next batch of bytes.

Exceptions:
MPSException   if there's a problem writing.

Definition at line 235 of file OutputStream.java.

private void OutputStream::open ( ) [inline, private]
 

Causes the connection to the server to open, if it isn't already open.

Exceptions:
MPSException   from connection.getOutputStream() if there's a problem
See also:
org.hebe.mps.ConnectiongetOutputStream

Definition at line 117 of file OutputStream.java.

Referenced by flush().

public void OutputStream::resetBuffer ( ) [inline, private]
 

Resets our internal buffer to empty.

Definition at line 74 of file OutputStream.java.

Referenced by Server::Runnable::run().

private void OutputStream::setupBuffer ( ) [inline, private]
 

Creates and initialises a fresh StringBuffer in member variable buffer.

Definition at line 68 of file OutputStream.java.

Referenced by OutputStream(), flush(), and resetBuffer().

private void OutputStream::write ( int ch ) [inline, private]
 

Buffer up a single byte to send.

The buffer is not flushed to the server until the flush() method is called.

Parameters:
ch   the byte to buffer up
See also:
org.hebe.mps.OutputStreamflush

Definition at line 97 of file OutputStream.java.

Referenced by flush(), writebool(), writechar(), writeint(), writelong(), and writestring().

public void OutputStream::writeReference ( Object o ) [inline, private]
 

Writes a reference to an MPS object to the remote end.

Sends a canonical name for the object as a string. The remote end will then construct a proxy on the other side of the connection to make use of the reference that has been sent to it.

Parameters:
o   the MPS Interface to write
Exceptions:
MPSException   if there's a problem writing
MPSException   if o is not being served by an instance of Server and o is not an instance of Proxy

See also:
org.hebe.mps.Proxy , org.hebe.mps.InputStreamreadReference

Definition at line 198 of file OutputStream.java.

public void OutputStream::writebool ( boolean b ) [inline, private]
 

Writes a single boolean to the server.

Parameters:
b   the boolean to write

Definition at line 154 of file OutputStream.java.

public void OutputStream::writechar ( char ch ) [inline, private]
 

Writes a single char to the server.

Parameters:
ch   the char to write

Definition at line 179 of file OutputStream.java.

public void OutputStream::writefloat ( float f ) [inline, private]
 

Writes a single float to the server.

Parameters:
f   the float to write
Exceptions:
MPSException   if there's a problem writing

Definition at line 224 of file OutputStream.java.

public void OutputStream::writeint ( int i ) [inline, private]
 

Writes a single int to the server.

Parameters:
i   the 32-bit signed value to write

Definition at line 127 of file OutputStream.java.

Referenced by Proxy::getOutputStream(), Server::Runnable::run(), and writefloat().

public void OutputStream::writelong ( long i ) [inline, private]
 

Writes a single long to the server.

Parameters:
i   the long to write

Definition at line 163 of file OutputStream.java.

public void OutputStream::writestring ( String s ) [inline, private]
 

Writes a single java.lang.String to the server.

Parameters:
s   the string to write

Definition at line 139 of file OutputStream.java.

Referenced by writeReference().


Member Data Documentation

private StringBuffer OutputStream::buffer [private]
 

Definition at line 51 of file OutputStream.java.

private Connection OutputStream::connection [private]
 

Definition at line 49 of file OutputStream.java.

private java io OutputStream OutputStream::output [private]
 

Definition at line 50 of file OutputStream.java.


The documentation for this class was generated from the following file:
Generated at Wed Aug 15 01:05:35 2001 for mps-java by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001