publicstaticvoid main(String[] argv) throws Exception {
PipedOutputStream os = new PipedOutputStream();
PipedInputStream is = new PipedInputStream();
is.connect(os);
// create reader thread
LazyReader lr = new LazyReader(is);
os.write(newbyte[1000]);
lr.start(); while (lr.isAlive()) { Thread.sleep(100);
}
try{
os.write(27); thrownew Exception
("Test failed: shouldn't be able to write");
} catch (IOException e) { // test passed
}
}
}
class LazyReader extendsThread { private PipedInputStream snk; privateint delay;
public LazyReader(PipedInputStream snk) { this.snk = snk;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.