ADT
ast-experimental
enum
pthread-emulation
qualifiedEnum
|
Last change
on this file since 04821de was 67982887, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago |
|
specialize thesis directory-names
|
-
Property mode
set to
100644
|
|
File size:
916 bytes
|
| Line | |
|---|
| 1 | public class res {
|
|---|
| 2 | private ires res;
|
|---|
| 3 | public res(ires res) {
|
|---|
| 4 | this.res = res;
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | public void dotest(String msg, int open, int write, int close) {
|
|---|
| 8 | try {
|
|---|
| 9 | System.out.println(msg);
|
|---|
| 10 | FileOutputStream.throwOnOpen = open;
|
|---|
| 11 | FileOutputStream.throwOnWrite = write;
|
|---|
| 12 | FileOutputStream.throwOnClose = close;
|
|---|
| 13 | res.write("foo.txt", "output message");
|
|---|
| 14 | } catch (Exception ex) {
|
|---|
| 15 | }
|
|---|
| 16 | FileOutputStream.numOpens = 0;
|
|---|
| 17 | FileOutputStream.numWrites = 0;
|
|---|
| 18 | FileOutputStream.numCloses = 0;
|
|---|
| 19 | System.gc();
|
|---|
| 20 | System.runFinalization();
|
|---|
| 21 | System.out.println();
|
|---|
| 22 | System.out.flush();
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | public static void dotest(ires res) {
|
|---|
| 26 | res r = new res(res);
|
|---|
| 27 | r.dotest("Exception on open 1", 1, 0, 0);
|
|---|
| 28 | r.dotest("Exception on open 2", 2, 0, 0);
|
|---|
| 29 | r.dotest("Exception on write 1", 0, 1, 0);
|
|---|
| 30 | r.dotest("Exception on write 2", 0, 2, 0);
|
|---|
| 31 | r.dotest("Exception on close 1", 0, 0, 1);
|
|---|
| 32 | r.dotest("Exception on close 2", 0, 0, 2);
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.