Import java.io.ioException; import java.io.outputstream;
Public class charterminatedoutputstream extends outputstream {
Private OutputStream out;
Private byte [] match;
public CharTerminatedOutputStream (OutputStream os, byte [] terminator) {if (terminator == null) {throw new IllegalArgumentException ( "The terminating character array can not be null.");} if (terminator.length == 0) {throw new IllegalArgumentException "" The Terminating Character Array Cannot BE of Zero Length. ");
Match = new byte [Terminator.Length]; for (int i = 0; i
Public void write (int b) throws ioException {out.write (b);}
Public void flush () throws ioException {out.write (match); out.flush ();}}