Reads the next line of an HTTP multipart content. @return line, or null if end of stream is reached @throws IOException I/O Exception
()
| 204 | * @throws IOException I/O Exception |
| 205 | */ |
| 206 | private byte[] readLine() throws IOException { |
| 207 | final ByteList bl = new ByteList(); |
| 208 | for(int b; (b = input.read()) != -1;) { |
| 209 | // RFC 1341: a line ends with CRLF |
| 210 | while(b == '\r') { |
| 211 | b = input.read(); |
| 212 | if(b == '\n') return bl.finish(); |
| 213 | bl.add('\r'); |
| 214 | if(b == -1) return bl.finish(); |
| 215 | } |
| 216 | bl.add(b); |
| 217 | } |
| 218 | return bl.isEmpty() ? null : bl.finish(); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Extracts the encapsulation boundary from the media type. |
no test coverage detected