帮助理解的测试类
package test;
import java.util.StringTokenizer;
import java.io.File;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class Test {
public static String ss = "Title1=Java:this is the tile1 field;"+
"Title2=Java:this is the tile2 field;"+
"Title3=Java:this is the tile3 field;"+
"Title4=Java:this is the tile4 field;"+
"Title5=Java:this is the tile5 field;"
;
public Test() {
}
public static void main(String [] args) throws IOException {
StringTokenizer st = new StringTokenizer(ss,"=;",false);
//System.out.println("st.countTokens():"+st.countTokens());
while(st.hasMoreTokens()){
//System.out.println("st.countTokens():"+st.countTokens());
String key = st.nextToken();
String value = st.nextToken();
//System.out.println("key = :" +key + "\n" + "value =:" + value);
}
String s = "abcde&fgh61=klklkl";
System.out.println("s.indexOf(61):"+s.indexOf(61));
File file;
file = File.createTempFile("policy","pdf");
System.out.println(file.getName());
System.out.println(file.getAbsolutePath());
System.out.println(file.getAbsoluteFile());
System.out.println(file.getCanonicalPath());
System.out.println(file.toURL());
System.out.println(file.toString());
OutputStream out = new FileOutputStream(file);
}
}
浙公网安备 33010602011771号