super(header);
}
@Override
public Warning readValue() throws IOException {
Warning result = new Warning();
String code = readToken();
skipSpaces();
String agent = readRawText();
skipSpaces();
String text = readQuotedString();
// The date is not mandatory
skipSpaces();
String date = null;
if (peek() != -1) {
date = readQuotedString();
}
if ((code == null) || (agent == null) || (text == null)) {
throw new IOException("Warning header malformed.");
}
result.setStatus(Status.valueOf(Integer.parseInt(code)));
result.setAgent(agent);
result.setText(text);
if (date != null) {
result.setDate(DateUtils.parse(date));
}
return result;
}