AbstractStreamingHashFunction.java
4.99 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
package com.google.common.hash;
import com.google.common.base.Preconditions;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import qs;
public abstract class AbstractStreamingHashFunction
implements HashFunction
{
public HashCode hashBytes(byte[] paramArrayOfByte)
{
return newHasher().putBytes(paramArrayOfByte).hash();
}
public HashCode hashBytes(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
{
return newHasher().putBytes(paramArrayOfByte, paramInt1, paramInt2).hash();
}
public HashCode hashInt(int paramInt)
{
return newHasher().putInt(paramInt).hash();
}
public HashCode hashLong(long paramLong)
{
return newHasher().putLong(paramLong).hash();
}
public <T> HashCode hashObject(T paramT, Funnel<? super T> paramFunnel)
{
return newHasher().putObject(paramT, paramFunnel).hash();
}
public HashCode hashString(CharSequence paramCharSequence, Charset paramCharset)
{
return newHasher().putString(paramCharSequence, paramCharset).hash();
}
public HashCode hashUnencodedChars(CharSequence paramCharSequence)
{
return newHasher().putUnencodedChars(paramCharSequence).hash();
}
public Hasher newHasher(int paramInt)
{
if (paramInt >= 0) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool);
return newHasher();
}
}
public static abstract class AbstractStreamingHasher
extends qs
{
private final ByteBuffer a;
private final int b;
private final int c;
protected AbstractStreamingHasher(int paramInt)
{
this(paramInt, paramInt);
}
protected AbstractStreamingHasher(int paramInt1, int paramInt2)
{
if (paramInt2 % paramInt1 == 0) {}
for (boolean bool = true;; bool = false)
{
Preconditions.checkArgument(bool);
this.a = ByteBuffer.allocate(paramInt2 + 7).order(ByteOrder.LITTLE_ENDIAN);
this.b = paramInt2;
this.c = paramInt1;
return;
}
}
private void b()
{
if (this.a.remaining() < 8) {
c();
}
}
private void c()
{
this.a.flip();
while (this.a.remaining() >= this.c) {
process(this.a);
}
this.a.compact();
}
public abstract HashCode a();
public final HashCode hash()
{
c();
this.a.flip();
if (this.a.remaining() > 0) {
processRemaining(this.a);
}
return a();
}
public abstract void process(ByteBuffer paramByteBuffer);
public void processRemaining(ByteBuffer paramByteBuffer)
{
paramByteBuffer.position(paramByteBuffer.limit());
paramByteBuffer.limit(this.c + 7);
while (paramByteBuffer.position() < this.c) {
paramByteBuffer.putLong(0L);
}
paramByteBuffer.limit(this.c);
paramByteBuffer.flip();
process(paramByteBuffer);
}
public final Hasher putByte(byte paramByte)
{
this.a.put(paramByte);
b();
return this;
}
public final Hasher putBytes(byte[] paramArrayOfByte)
{
return putBytes(paramArrayOfByte, 0, paramArrayOfByte.length);
}
public final Hasher putBytes(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
{
paramArrayOfByte = ByteBuffer.wrap(paramArrayOfByte, paramInt1, paramInt2).order(ByteOrder.LITTLE_ENDIAN);
if (paramArrayOfByte.remaining() <= this.a.remaining())
{
this.a.put(paramArrayOfByte);
b();
return this;
}
paramInt2 = this.b;
int i = this.a.position();
paramInt1 = 0;
while (paramInt1 < paramInt2 - i)
{
this.a.put(paramArrayOfByte.get());
paramInt1 += 1;
}
c();
while (paramArrayOfByte.remaining() >= this.c) {
process(paramArrayOfByte);
}
this.a.put(paramArrayOfByte);
return this;
}
public final Hasher putChar(char paramChar)
{
this.a.putChar(paramChar);
b();
return this;
}
public final Hasher putInt(int paramInt)
{
this.a.putInt(paramInt);
b();
return this;
}
public final Hasher putLong(long paramLong)
{
this.a.putLong(paramLong);
b();
return this;
}
public final <T> Hasher putObject(T paramT, Funnel<? super T> paramFunnel)
{
paramFunnel.funnel(paramT, this);
return this;
}
public final Hasher putShort(short paramShort)
{
this.a.putShort(paramShort);
b();
return this;
}
public final Hasher putUnencodedChars(CharSequence paramCharSequence)
{
int i = 0;
while (i < paramCharSequence.length())
{
putChar(paramCharSequence.charAt(i));
i += 1;
}
return this;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/hash/AbstractStreamingHashFunction.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/