FileBackedOutputStream.java
5.91 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
package com.google.common.io;
import com.google.common.annotations.Beta;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@Beta
public final class FileBackedOutputStream
extends OutputStream
{
private final int a;
private final boolean b;
private final ByteSource c;
private OutputStream d;
private a e;
private File f;
public FileBackedOutputStream(int paramInt)
{
this(paramInt, false);
}
public FileBackedOutputStream(int paramInt, boolean paramBoolean)
{
this.a = paramInt;
this.b = paramBoolean;
this.e = new a((byte)0);
this.d = this.e;
if (paramBoolean)
{
this.c = new ByteSource()
{
protected final void finalize()
{
try
{
FileBackedOutputStream.this.reset();
return;
}
catch (Throwable localThrowable)
{
localThrowable.printStackTrace(System.err);
}
}
public final InputStream openStream()
throws IOException
{
return FileBackedOutputStream.a(FileBackedOutputStream.this);
}
};
return;
}
this.c = new ByteSource()
{
public final InputStream openStream()
throws IOException
{
return FileBackedOutputStream.a(FileBackedOutputStream.this);
}
};
}
/* Error */
private InputStream a()
throws IOException
{
// Byte code:
// 0: aload_0
// 1: monitorenter
// 2: aload_0
// 3: getfield 54 com/google/common/io/FileBackedOutputStream:f Ljava/io/File;
// 6: ifnull +19 -> 25
// 9: new 56 java/io/FileInputStream
// 12: dup
// 13: aload_0
// 14: getfield 54 com/google/common/io/FileBackedOutputStream:f Ljava/io/File;
// 17: invokespecial 59 java/io/FileInputStream:<init> (Ljava/io/File;)V
// 20: astore_1
// 21: aload_0
// 22: monitorexit
// 23: aload_1
// 24: areturn
// 25: new 61 java/io/ByteArrayInputStream
// 28: dup
// 29: aload_0
// 30: getfield 41 com/google/common/io/FileBackedOutputStream:e Lcom/google/common/io/FileBackedOutputStream$a;
// 33: invokevirtual 64 com/google/common/io/FileBackedOutputStream$a:a ()[B
// 36: iconst_0
// 37: aload_0
// 38: getfield 41 com/google/common/io/FileBackedOutputStream:e Lcom/google/common/io/FileBackedOutputStream$a;
// 41: invokevirtual 67 com/google/common/io/FileBackedOutputStream$a:b ()I
// 44: invokespecial 70 java/io/ByteArrayInputStream:<init> ([BII)V
// 47: astore_1
// 48: goto -27 -> 21
// 51: astore_1
// 52: aload_0
// 53: monitorexit
// 54: aload_1
// 55: athrow
// Local variable table:
// start length slot name signature
// 0 56 0 this FileBackedOutputStream
// 20 28 1 localObject1 Object
// 51 4 1 localObject2 Object
// Exception table:
// from to target type
// 2 21 51 finally
// 25 48 51 finally
}
private void a(int paramInt)
throws IOException
{
if ((this.f == null) && (this.e.b() + paramInt > this.a))
{
File localFile = File.createTempFile("FileBackedOutputStream", null);
if (this.b) {
localFile.deleteOnExit();
}
FileOutputStream localFileOutputStream = new FileOutputStream(localFile);
localFileOutputStream.write(this.e.a(), 0, this.e.b());
localFileOutputStream.flush();
this.d = localFileOutputStream;
this.f = localFile;
this.e = null;
}
}
public final ByteSource asByteSource()
{
return this.c;
}
public final void close()
throws IOException
{
try
{
this.d.close();
return;
}
finally
{
localObject = finally;
throw ((Throwable)localObject);
}
}
public final void flush()
throws IOException
{
try
{
this.d.flush();
return;
}
finally
{
localObject = finally;
throw ((Throwable)localObject);
}
}
public final void reset()
throws IOException
{
try
{
Object localObject1;
File localFile;
String str;
return;
}
finally
{
if (this.e == null) {
this.e = new a((byte)0);
}
for (;;)
{
this.d = this.e;
if (this.f == null) {
break;
}
localFile = this.f;
this.f = null;
if (localFile.delete()) {
break;
}
str = String.valueOf(String.valueOf(localFile));
throw new IOException(str.length() + 18 + "Could not delete: " + str);
this.e.reset();
}
}
}
public final void write(int paramInt)
throws IOException
{
try
{
a(1);
this.d.write(paramInt);
return;
}
finally
{
localObject = finally;
throw ((Throwable)localObject);
}
}
public final void write(byte[] paramArrayOfByte)
throws IOException
{
try
{
write(paramArrayOfByte, 0, paramArrayOfByte.length);
return;
}
finally
{
paramArrayOfByte = finally;
throw paramArrayOfByte;
}
}
public final void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
throws IOException
{
try
{
a(paramInt2);
this.d.write(paramArrayOfByte, paramInt1, paramInt2);
return;
}
finally
{
paramArrayOfByte = finally;
throw paramArrayOfByte;
}
}
static final class a
extends ByteArrayOutputStream
{
final byte[] a()
{
return this.buf;
}
final int b()
{
return this.count;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/io/FileBackedOutputStream.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/