Output streaming used to determine the end of the character

zhaozj2021-02-16  73

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 ();}}

转载请注明原文地址:https://www.9cbs.com/read-13804.html

New Post(0)