📄 abstractaction.java
字号:
package com.wireless.sms.gwif.smsagent.func;
import java.io.*;
import java.util.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public abstract class AbstractAction {
protected String getFormatedTermId(String termid) {
if ((termid.length() % 2) == 1) {
termid = termid + "f";
}
// if(termid.startsWith("13")){
// termid = "86"+termid;
// }
String new_termid="";
int i = 0;
while(i<termid.length()){
String s1 = termid.substring(i,i+1);
String s2 = termid.substring(i+1,i+2);
new_termid = new_termid+s2+s1;
i++;
i++;
}
return new_termid;
}
protected Properties getContent(String fileurl){
File f = new File(fileurl);
Properties pros = new Properties();
try{
pros.load(new FileInputStream(f));
}catch(IOException e){
System.err.println("Abstract Action getContent IOException: "+e.getMessage());
}
return pros;
}
protected String getHexNumber(int i){
String hex = Integer.toHexString(i);
if(hex.length() < 2){
hex = "0"+hex;
}
return hex;
}
protected String getSequence(){
return getHexNumber(new Random().nextInt(255));
}
protected String getHexContent(String content){
byte[] bb = content.getBytes();
StringBuffer sb = new StringBuffer();
for(int i = 0; i < bb.length; i++){
String s = Integer.toHexString(bb[i]);
if(bb[i]<0){
s = s.substring(s.length()-2);
}
else if(s.length()==1){
sb.append("0");
}
sb.append(s);
}
return sb.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -