39 |
package gnu.inet.nntp; |
package gnu.inet.nntp; |
40 |
|
|
41 |
import java.io.IOException; |
import java.io.IOException; |
42 |
|
import java.net.ProtocolException; |
43 |
import java.util.NoSuchElementException; |
import java.util.NoSuchElementException; |
44 |
|
|
45 |
/** |
/** |
79 |
{ |
{ |
80 |
String line = nextLine(); |
String line = nextLine(); |
81 |
|
|
82 |
// Parse line |
try |
83 |
int start = 0, end; |
{ |
84 |
end = line.indexOf(' ', start); |
// Parse line |
85 |
String articleId = line.substring(start, end); |
int start = 0, end; |
86 |
start = end + 1; |
end = line.indexOf(' ', start); |
87 |
String header = line.substring(start); |
String articleId = line.substring(start, end); |
88 |
|
start = end + 1; |
89 |
return new HeaderEntry(articleId, header); |
String header = line.substring(start); |
90 |
|
|
91 |
|
return new HeaderEntry(articleId, header); |
92 |
|
} |
93 |
|
catch (StringIndexOutOfBoundsException e) |
94 |
|
{ |
95 |
|
ProtocolException e2 = |
96 |
|
new ProtocolException("Invalid header line: " + line); |
97 |
|
e2.initCause(e); |
98 |
|
throw e2; |
99 |
|
} |
100 |
} |
} |
101 |
|
|
102 |
} |
} |