| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
package jpype.closeable; |
| 17 |
|
| 18 |
class CloseableTest implements java.io.Closeable |
| 19 |
{ |
| 20 |
|
| 21 |
public static boolean closed = false; |
| 22 |
public static String printed = ""; |
| 23 |
public static boolean willfail = false; |
| 24 |
public static boolean failed = false; |
| 25 |
|
| 26 |
public static void reset() |
| 27 |
{ |
| 28 |
closed = false; |
| 29 |
willfail = false; |
| 30 |
failed = false; |
| 31 |
printed = ""; |
| 32 |
} |
| 33 |
|
| 34 |
public CloseableTest() |
| 35 |
{ |
| 36 |
} |
| 37 |
|
| 38 |
public void print(String value) |
| 39 |
{ |
| 40 |
printed = value; |
| 41 |
} |
| 42 |
|
| 43 |
public void throwException() |
| 44 |
{ |
| 45 |
throw new RuntimeException("oh no!"); |
| 46 |
} |
| 47 |
|
| 48 |
public void close() throws java.io.IOException |
| 49 |
{ |
| 50 |
closed = true; |
| 51 |
if (willfail) |
| 52 |
{ |
| 53 |
failed = true; |
| 54 |
throw new java.io.IOException("oh my?"); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
} |