package frame.variant;
|
|
public class NameValuePair {
|
|
private String name;
|
private String value;
|
|
|
public NameValuePair(String content) throws Exception {
|
parse(content);
|
}
|
|
private void parse(String content) throws Exception {
|
if (content == null) {
|
throw new Exception("NameValuePair error : empty content");
|
}
|
|
int pos = content.indexOf("=");
|
|
if (pos <= 0) {
|
throw new Exception("NameValuePair error , wrong format : " + content);
|
}
|
|
name = content.substring(0, pos);
|
value = content.substring(pos + 1);
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
|
public String getValue() {
|
return value;
|
}
|
}
|