CharSink.java
2.58 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
package com.google.common.io;
import com.google.common.base.Preconditions;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
public abstract class CharSink
{
public Writer openBufferedStream()
throws IOException
{
Writer localWriter = openStream();
if ((localWriter instanceof BufferedWriter)) {
return (BufferedWriter)localWriter;
}
return new BufferedWriter(localWriter);
}
public abstract Writer openStream()
throws IOException;
public void write(CharSequence paramCharSequence)
throws IOException
{
Preconditions.checkNotNull(paramCharSequence);
Closer localCloser = Closer.create();
try
{
Writer localWriter = (Writer)localCloser.register(openStream());
localWriter.append(paramCharSequence);
localWriter.flush();
return;
}
catch (Throwable paramCharSequence)
{
throw localCloser.rethrow(paramCharSequence);
}
finally
{
localCloser.close();
}
}
public long writeFrom(Readable paramReadable)
throws IOException
{
Preconditions.checkNotNull(paramReadable);
Closer localCloser = Closer.create();
try
{
Writer localWriter = (Writer)localCloser.register(openStream());
long l = CharStreams.copy(paramReadable, localWriter);
localWriter.flush();
return l;
}
catch (Throwable paramReadable)
{
throw localCloser.rethrow(paramReadable);
}
finally
{
localCloser.close();
}
}
public void writeLines(Iterable<? extends CharSequence> paramIterable)
throws IOException
{
writeLines(paramIterable, System.getProperty("line.separator"));
}
public void writeLines(Iterable<? extends CharSequence> paramIterable, String paramString)
throws IOException
{
Preconditions.checkNotNull(paramIterable);
Preconditions.checkNotNull(paramString);
Closer localCloser = Closer.create();
Writer localWriter;
try
{
localWriter = (Writer)localCloser.register(openBufferedStream());
paramIterable = paramIterable.iterator();
while (paramIterable.hasNext()) {
localWriter.append((CharSequence)paramIterable.next()).append(paramString);
}
}
catch (Throwable paramIterable)
{
throw localCloser.rethrow(paramIterable);
}
finally
{
localCloser.close();
}
localCloser.close();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/io/CharSink.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/