/** * Parse a header attribute and set the corresponding data in the {@link Headers} fields. */ protected void parseHeader(String line, Headers headers) { int sepIndex = line.indexOf(':'); if (sepIndex >= 0) { String key = line.substring(0, sepIndex).trim(); switch (key) { case CONTENT_LENGTH_HEADER: try { headers.contentLength = Integer.parseInt(line.substring(sepIndex + 1).trim()); } catch (NumberFormatException e) { fireError(e); } break; case CONTENT_TYPE_HEADER: { int charsetIndex = line.indexOf("charset="); if (charsetIndex >= 0) headers.charset = line.substring(charsetIndex + 8).trim(); break; } } } }
/** * Parse a header attribute and set the corresponding data in the {@link Headers} fields. */ protected void parseHeader(String line, Headers headers) { int sepIndex = line.indexOf(':'); if (sepIndex >= 0) { String key = line.substring(0, sepIndex).trim(); switch (key) { case CONTENT_LENGTH_HEADER: try { headers.contentLength = Integer.parseInt(line.substring(sepIndex + 1).trim()); } catch (NumberFormatException e) { fireError(e); } break; case CONTENT_TYPE_HEADER: { int charsetIndex = line.indexOf("charset="); if (charsetIndex >= 0) headers.charset = line.substring(charsetIndex + 8).trim(); break; } } } }
fireError(new IllegalStateException("Missing header " + CONTENT_LENGTH_HEADER + " in input \"" + debugBuilder + "\"")); } else {
fireError(new IllegalStateException("Missing header " + CONTENT_LENGTH_HEADER + " in input \"" + debugBuilder + "\"")); } else {