com.dalsemi.comm
Class NullOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--com.dalsemi.comm.NullOutputStream

public class NullOutputStream
extends OutputStream

This class is used as an outlet when data is available for output but a port is not currently available. NullOutputStreams are used when the java.lang.System class initializes. System.out and System.err are initialized to this class so that system initialization routines do not have to open any devices.

This class is also useful in other instances. In Slush, if a telnet session runs a process in the background and the telnet session is closed, the background process now holds an invalid OutputStream. Slush changes the process' OutputStream to a NullOutputStream so the background process can continue to run.

See Also:
NullInputStream

Constructor Summary
NullOutputStream()
           
 
Method Summary
 void write(byte[] barr, int offset, int length)
          Writes the specified array to this NullOutputStream.
 void write(int b)
          Writes the specified byte to this NullOutputStream.
 
Methods inherited from class java.io.OutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullOutputStream

public NullOutputStream()
Method Detail

write

public void write(int b)
Writes the specified byte to this NullOutputStream. The data is not actually written to any port or device.
Overrides:
write in class OutputStream
Parameters:
b - data to be sent

write

public void write(byte[] barr,
                  int offset,
                  int length)
Writes the specified array to this NullOutputStream. The data is not actually written to any port or device. This method is included so writes to this NullOutputStream will occur faster.
Overrides:
write in class OutputStream
Parameters:
barr - the array containing data to be output
offset - offset into array where data starts
length - number of bytes to be sent