CharSource.java
8.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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
package com.google.common.io;
import com.google.common.annotations.Beta;
import com.google.common.base.Ascii;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
import rb;
import rf;
public abstract class CharSource
{
public static CharSource concat(Iterable<? extends CharSource> paramIterable)
{
return new b(paramIterable);
}
public static CharSource concat(Iterator<? extends CharSource> paramIterator)
{
return concat(ImmutableList.copyOf(paramIterator));
}
public static CharSource concat(CharSource... paramVarArgs)
{
return concat(ImmutableList.copyOf(paramVarArgs));
}
public static CharSource empty()
{
return c.b();
}
public static CharSource wrap(CharSequence paramCharSequence)
{
return new a(paramCharSequence);
}
public long copyTo(CharSink paramCharSink)
throws IOException
{
Preconditions.checkNotNull(paramCharSink);
Closer localCloser = Closer.create();
try
{
long l = CharStreams.copy((Reader)localCloser.register(openStream()), (Writer)localCloser.register(paramCharSink.openStream()));
return l;
}
catch (Throwable paramCharSink)
{
throw localCloser.rethrow(paramCharSink);
}
finally
{
localCloser.close();
}
}
public long copyTo(Appendable paramAppendable)
throws IOException
{
Preconditions.checkNotNull(paramAppendable);
Closer localCloser = Closer.create();
try
{
long l = CharStreams.copy((Reader)localCloser.register(openStream()), paramAppendable);
return l;
}
catch (Throwable paramAppendable)
{
throw localCloser.rethrow(paramAppendable);
}
finally
{
localCloser.close();
}
}
/* Error */
public boolean isEmpty()
throws IOException
{
// Byte code:
// 0: invokestatic 71 com/google/common/io/Closer:create ()Lcom/google/common/io/Closer;
// 3: astore_3
// 4: aload_3
// 5: aload_0
// 6: invokevirtual 75 com/google/common/io/CharSource:openStream ()Ljava/io/Reader;
// 9: invokevirtual 79 com/google/common/io/Closer:register (Ljava/io/Closeable;)Ljava/io/Closeable;
// 12: checkcast 81 java/io/Reader
// 15: invokevirtual 109 java/io/Reader:read ()I
// 18: istore_1
// 19: iload_1
// 20: iconst_m1
// 21: if_icmpne +11 -> 32
// 24: iconst_1
// 25: istore_2
// 26: aload_3
// 27: invokevirtual 97 com/google/common/io/Closer:close ()V
// 30: iload_2
// 31: ireturn
// 32: iconst_0
// 33: istore_2
// 34: goto -8 -> 26
// 37: astore 4
// 39: aload_3
// 40: aload 4
// 42: invokevirtual 101 com/google/common/io/Closer:rethrow (Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
// 45: athrow
// 46: astore 4
// 48: aload_3
// 49: invokevirtual 97 com/google/common/io/Closer:close ()V
// 52: aload 4
// 54: athrow
// Local variable table:
// start length slot name signature
// 0 55 0 this CharSource
// 18 4 1 i int
// 25 9 2 bool boolean
// 3 46 3 localCloser Closer
// 37 4 4 localThrowable Throwable
// 46 7 4 localObject Object
// Exception table:
// from to target type
// 4 19 37 java/lang/Throwable
// 4 19 46 finally
// 39 46 46 finally
}
public BufferedReader openBufferedStream()
throws IOException
{
Reader localReader = openStream();
if ((localReader instanceof BufferedReader)) {
return (BufferedReader)localReader;
}
return new BufferedReader(localReader);
}
public abstract Reader openStream()
throws IOException;
public String read()
throws IOException
{
Closer localCloser = Closer.create();
try
{
String str = CharStreams.toString((Reader)localCloser.register(openStream()));
return str;
}
catch (Throwable localThrowable)
{
throw localCloser.rethrow(localThrowable);
}
finally
{
localCloser.close();
}
}
@Nullable
public String readFirstLine()
throws IOException
{
Closer localCloser = Closer.create();
try
{
String str = ((BufferedReader)localCloser.register(openBufferedStream())).readLine();
return str;
}
catch (Throwable localThrowable)
{
throw localCloser.rethrow(localThrowable);
}
finally
{
localCloser.close();
}
}
public ImmutableList<String> readLines()
throws IOException
{
Closer localCloser = Closer.create();
try
{
BufferedReader localBufferedReader = (BufferedReader)localCloser.register(openBufferedStream());
ArrayList localArrayList = Lists.newArrayList();
for (;;)
{
String str = localBufferedReader.readLine();
if (str == null) {
break;
}
localArrayList.add(str);
}
localImmutableList = ImmutableList.copyOf(localArrayList);
}
catch (Throwable localThrowable)
{
throw localCloser.rethrow(localThrowable);
}
finally
{
localCloser.close();
}
ImmutableList localImmutableList;
localCloser.close();
return localImmutableList;
}
@Beta
public <T> T readLines(LineProcessor<T> paramLineProcessor)
throws IOException
{
Preconditions.checkNotNull(paramLineProcessor);
Closer localCloser = Closer.create();
try
{
paramLineProcessor = CharStreams.readLines((Reader)localCloser.register(openStream()), paramLineProcessor);
return paramLineProcessor;
}
catch (Throwable paramLineProcessor)
{
throw localCloser.rethrow(paramLineProcessor);
}
finally
{
localCloser.close();
}
}
static class a
extends CharSource
{
private static final Splitter a = Splitter.on(Pattern.compile("\r\n|\n|\r"));
private final CharSequence b;
protected a(CharSequence paramCharSequence)
{
this.b = ((CharSequence)Preconditions.checkNotNull(paramCharSequence));
}
private Iterable<String> b()
{
new Iterable()
{
public final Iterator<String> iterator()
{
new AbstractIterator()
{
Iterator<String> a = CharSource.a.a().split(CharSource.a.a(CharSource.a.this)).iterator();
};
}
};
}
public boolean isEmpty()
{
return this.b.length() == 0;
}
public Reader openStream()
{
return new rb(this.b);
}
public String read()
{
return this.b.toString();
}
public String readFirstLine()
{
Iterator localIterator = b().iterator();
if (localIterator.hasNext()) {
return (String)localIterator.next();
}
return null;
}
public ImmutableList<String> readLines()
{
return ImmutableList.copyOf(b());
}
public <T> T readLines(LineProcessor<T> paramLineProcessor)
throws IOException
{
Iterator localIterator = b().iterator();
while ((localIterator.hasNext()) && (paramLineProcessor.processLine((String)localIterator.next()))) {}
return (T)paramLineProcessor.getResult();
}
public String toString()
{
String str = String.valueOf(String.valueOf(Ascii.truncate(this.b, 30, "...")));
return str.length() + 17 + "CharSource.wrap(" + str + ")";
}
}
static final class b
extends CharSource
{
private final Iterable<? extends CharSource> a;
b(Iterable<? extends CharSource> paramIterable)
{
this.a = ((Iterable)Preconditions.checkNotNull(paramIterable));
}
public final boolean isEmpty()
throws IOException
{
Iterator localIterator = this.a.iterator();
while (localIterator.hasNext()) {
if (!((CharSource)localIterator.next()).isEmpty()) {
return false;
}
}
return true;
}
public final Reader openStream()
throws IOException
{
return new rf(this.a.iterator());
}
public final String toString()
{
String str = String.valueOf(String.valueOf(this.a));
return str.length() + 19 + "CharSource.concat(" + str + ")";
}
}
static final class c
extends CharSource.a
{
private static final c a = new c();
private c()
{
super();
}
public final String toString()
{
return "CharSource.empty()";
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/io/CharSource.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/