com.monica.javacom.streams
Class MJCWriterIsAOS

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.monica.javacom.streams.MJCWriterIsAOS
All Implemented Interfaces:
MJCWriter

public class MJCWriterIsAOS
extends java.io.OutputStream
implements MJCWriter

Class to enable to write into the MJC layer hierarchy using the conventional OutputStream methods. Objects of this class act as OutputStreams, and they forward the data written on them to MJCWriteables.


Constructor Summary
MJCWriterIsAOS()
          Default constructor.
 
Method Summary
 void close()
          Closes the OuputStream.
 void flush()
          Flushes the contents of the buffer to the MJCWriteable of this object.
 MJCWriteable getWriteable()
          Returns the MJCWriteable to which this object writes.
 java.lang.String getWriterName()
          Returns the MJC name of the MJCWriter.
 java.lang.String getWriterVersion()
          Returns the MJC version of the MJCWriter.
 void setWriteable(MJCWriteable writeable)
          Sets the MJCWriteable to which this object writes.
 void write(byte[] b)
          Writes a byte array to the MJCWriteable of this object.
 void write(byte[] b, int off, int len)
          Writes a part (specified with beginning offset and length) of a byte array to the MJCWriteable of this object.
 void write(int b)
          Writes an int (0...255) to the MJCWriteable of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCWriterIsAOS

public MJCWriterIsAOS()
Default constructor.
Method Detail

getWriterName

public java.lang.String getWriterName()
Returns the MJC name of the MJCWriter.
Specified by:
getWriterName in interface MJCWriter
Returns:
String: the MJC name of the MJCWriter

getWriterVersion

public java.lang.String getWriterVersion()
Returns the MJC version of the MJCWriter.
Specified by:
getWriterVersion in interface MJCWriter
Returns:
String: the MJC version of the MJCWriter

setWriteable

public void setWriteable(MJCWriteable writeable)
Sets the MJCWriteable to which this object writes.
Specified by:
setWriteable in interface MJCWriter
Parameters:
MJCWriteable - writeable: the MCJWriteable to which this object writes

getWriteable

public MJCWriteable getWriteable()
Returns the MJCWriteable to which this object writes.
Specified by:
getWriteable in interface MJCWriter
Returns:
MJCWriteable: the MJCWriteable to which this object writes

write

public void write(int b)
           throws java.io.IOException
Writes an int (0...255) to the MJCWriteable of this object. Writing is buffered.
Overrides:
write in class java.io.OutputStream
Parameters:
int - b: the int to be written to the MCJWriteable
Throws:
IOException: - if something goes wrong

write

public void write(byte[] b)
           throws java.io.IOException
Writes a byte array to the MJCWriteable of this object. Writing is buffered.
Overrides:
write in class java.io.OutputStream
Parameters:
byte[] - b: the byte array to be written to the MCJWriteable
Throws:
IOException: - if something goes wrong

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes a part (specified with beginning offset and length) of a byte array to the MJCWriteable of this object. Writing is buffered.
Overrides:
write in class java.io.OutputStream
Parameters:
byte[] - b: the byte array to be written to the MCJWriteable
int - off: the beginning offset (inclusive) of the part to be written out
int - len: the length of the part to be written out
Throws:
IOException: - if something goes wrong

flush

public void flush()
           throws java.io.IOException
Flushes the contents of the buffer to the MJCWriteable of this object.
Overrides:
flush in class java.io.OutputStream

close

public void close()
           throws java.io.IOException
Closes the OuputStream. After a successful close, nothing can be written to it.
Overrides:
close in class java.io.OutputStream
Throws:
IOException: - if something goes wron