requesttitle.java

来自「我自己做的一个关于使用Ethereal抓包软件抓取SIP协议包后自己的协议分析软」· Java 代码 · 共 48 行

JAVA
48
字号
/*
 * RequestTitle.java
 *
 * Created on 2007年5月23日, 下午1:22
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package SIPTitle;

/**
 *
 * @author Administrator
 */
public class RequestTitle {
    
    private String requesttitle = null;
    private boolean flag = false;
    /** Creates a new instance of RequestTitle */
    public RequestTitle() {
    }
    
    public void setString(String string){
      
        int first = string.indexOf("sip:");   
        int last = string.lastIndexOf("SIP/2.0");
        if(first!=-1&&last!=-1&&last>first+7){       
            flag = true;
            requesttitle = string.substring(first,last+7);
        }
        else{
            flag = false;
            requesttitle = null;
        }
    }
    
    public boolean getVerify(){
        return flag;
    }

    
    public String getRequesttitle() {
        return requesttitle;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?