StatusLine.java
2.98 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
package com.squareup.okhttp.internal.http;
import com.squareup.okhttp.Protocol;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.net.ProtocolException;
public final class StatusLine
{
public static final int HTTP_CONTINUE = 100;
public static final int HTTP_PERM_REDIRECT = 308;
public static final int HTTP_TEMP_REDIRECT = 307;
public final int code;
public final String message;
public final Protocol protocol;
public StatusLine(Protocol paramProtocol, int paramInt, String paramString)
{
this.protocol = paramProtocol;
this.code = paramInt;
this.message = paramString;
}
public static StatusLine get(Response paramResponse)
{
return new StatusLine(paramResponse.protocol(), paramResponse.code(), paramResponse.message());
}
public static StatusLine parse(String paramString)
throws IOException
{
int i = 9;
int j;
Protocol localProtocol;
if (paramString.startsWith("HTTP/1."))
{
if ((paramString.length() < 9) || (paramString.charAt(8) != ' ')) {
throw new ProtocolException("Unexpected status line: " + paramString);
}
j = paramString.charAt(7) - '0';
if (j == 0) {
localProtocol = Protocol.HTTP_1_0;
}
}
while (paramString.length() < i + 3)
{
throw new ProtocolException("Unexpected status line: " + paramString);
if (j == 1)
{
localProtocol = Protocol.HTTP_1_1;
}
else
{
throw new ProtocolException("Unexpected status line: " + paramString);
if (paramString.startsWith("ICY "))
{
localProtocol = Protocol.HTTP_1_0;
i = 4;
}
else
{
throw new ProtocolException("Unexpected status line: " + paramString);
}
}
}
try
{
j = Integer.parseInt(paramString.substring(i, i + 3));
if (paramString.length() > i + 3) {
if (paramString.charAt(i + 3) != ' ') {
throw new ProtocolException("Unexpected status line: " + paramString);
}
}
}
catch (NumberFormatException localNumberFormatException)
{
throw new ProtocolException("Unexpected status line: " + paramString);
}
for (paramString = paramString.substring(i + 4);; paramString = "") {
return new StatusLine(localNumberFormatException, j, paramString);
}
}
public final String toString()
{
StringBuilder localStringBuilder = new StringBuilder();
if (this.protocol == Protocol.HTTP_1_0) {}
for (String str = "HTTP/1.0";; str = "HTTP/1.1")
{
localStringBuilder.append(str);
localStringBuilder.append(' ').append(this.code);
if (this.message != null) {
localStringBuilder.append(' ').append(this.message);
}
return localStringBuilder.toString();
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/squareup/okhttp/internal/http/StatusLine.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/