com.esf.device.serial.comm.service
Class SerialCommOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.esf.device.serial.comm.service.SerialCommOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public abstract class SerialCommOutputStream
extends java.io.OutputStream

This is an extension of the standard OutputStream, providing functionality to be able to wait for all data to be sent. This avoids the need to have an event driven mechanism for managing data output.

Author:
matt.demaree

Constructor Summary
SerialCommOutputStream()
           
 
Method Summary
abstract  void waitAllSent()
          Waits indefinitely for the data to clear from the transmit buffer.
abstract  void waitAllSent(int timeout)
          Waits up to the specified number of milliseconds for the transmit buffer to empty.
 
Methods inherited from class java.io.OutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialCommOutputStream

public SerialCommOutputStream()
Method Detail

waitAllSent

public abstract void waitAllSent()
                          throws java.io.IOException
Waits indefinitely for the data to clear from the transmit buffer.

Throws:
java.io.IOException - failure in waiting for the buffer to empty

waitAllSent

public abstract void waitAllSent(int timeout)
                          throws java.io.IOException
Waits up to the specified number of milliseconds for the transmit buffer to empty. A timeout is not considered a failure.

Parameters:
timeout - count of milliseconds to wait at most for buffer empty
Throws:
java.io.IOException - failure in waiting for the buffer to empty