?? httptype.java
字號(hào):
/**
*
*/
package edu.sysu.http.impl;
import edu.sysu.http.util.HttpGrammarException;
import edu.sysu.http.util.HttpRegex;
/**
* @author Administrator
*
*/
public class HttpType {
private String type;
private String subtype;
private HttpRegex regex = new HttpRegex();
/**
*
*/
public HttpType() {
// TODO Auto-generated constructor stub
this.regex.SetPattern(".+");
}
public HttpType(String type, String subtype) throws HttpGrammarException {
this();
this.setType(type);
this.setSubtype(subtype);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public void setType(String type) throws HttpGrammarException {
if (this.regex.Match(type))
this.type = type;
else
throw new HttpGrammarException("Type invalid.");
}
public String getType() {
return type;
}
public void setSubtype(String subtype) throws HttpGrammarException {
if (this.regex.Match(subtype))
this.subtype = subtype;
else
throw new HttpGrammarException("SubType invalid.");
}
public String getSubtype() {
return subtype;
}
public String toString() {
if(this.type != null && this.subtype != null)
return this.type + "/" + this.subtype;
else
return null;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -