DebugFileInputStream.java
2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* Decompiled with CFR 0_118.
*/
package com.day.io;
import java.io.*;
import java.util.HashSet;
import java.util.Iterator;
public class DebugFileInputStream
extends FileInputStream {
private static HashSet inputs = new HashSet();
private final File file;
private boolean closed = false;
private Throwable location = null;
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static void dumpRegistered(PrintWriter out) {
HashSet hashSet = inputs;
synchronized (hashSet) {
Iterator iter = inputs.iterator();
while (iter.hasNext()) {
DebugFileInputStream in = (DebugFileInputStream)iter.next();
in.dump(out);
}
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public static void dumpRegistered(PrintStream out) {
HashSet hashSet = inputs;
synchronized (hashSet) {
Iterator iter = inputs.iterator();
while (iter.hasNext()) {
DebugFileInputStream in = (DebugFileInputStream)iter.next();
in.dump(out);
}
}
}
public DebugFileInputStream(String name) throws FileNotFoundException {
this(new File(name));
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public DebugFileInputStream(File file) throws FileNotFoundException {
super(file);
this.file = file;
try {
throw new Throwable();
}
catch (Throwable t) {
this.location = t;
HashSet t = inputs;
synchronized (t) {
inputs.add(this);
}
return;
}
}
public void close() throws IOException {
this.closed = true;
super.close();
}
public void dump(PrintWriter out) {
out.println("path=" + this.file.getPath() + " closed=" + this.closed);
if (!this.closed) {
this.location.printStackTrace(out);
}
}
public void dump(PrintStream out) {
out.println("path=" + this.file.getPath() + " closed=" + this.closed);
if (!this.closed) {
this.location.printStackTrace(out);
}
}
}