e.printStackTrace();
}
File swf = new File(swfFilePath);
if (!swf.exists()) {
return false;
}
log.info("转化SWF文件成功!!!");
} catch (IOException e) {
// TODO Auto-generated catch block
log.error("转化为SWF文件失败!!!");
e.printStackTrace();
return false;
}
return true;
}
public static void main(String[] args) {
ConvertToSwf a=new ConvertToSwf("D:\\Program Files\\SWFTools");
a.convertFileToSwf("D:\\aa.pdf", "D:\\bb.swf");
}
private void dealWith(final Process pro){
// 下面是处理堵塞的情况
try {
new Thread(){
public void run(){
BufferedReader br1 = new BufferedReader(new InputStreamReader(pro.getInputStream()));
String text;
try {
while ( (text = br1.readLine()) != null) {
System.out.println(text);
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
} catch (Exception e) {
e.printStackTrace();
}
try {
new Thread(){
public void run(){
BufferedReader br2 = new BufferedReader(new InputStreamReader(pro.getErrorStream()));//这定不要忘记处理出理时产生的信息,不然会堵塞不前的
String text;
try {
while( (text = br2.readLine()) != null){
System.err.println(text);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
摘自 weiythi的Blog