将C# 转成Java代码

长智齿的程序媛 2015-08-13 11:28:23
如题。求大神帮帮忙。谢谢。。。
1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Web;
5 using System.Web.Security;
6 using System.Web.UI;
7 using System.Web.UI.WebControls;
8 using System.Web.UI.WebControls.WebParts;
9 using System.Web.UI.HtmlControls;
10 using System.Diagnostics;
11 using System.IO;
12
13 /// <summary>
14 /// Pdf2Swf 将pdf转化为swf
15 /// </summary>
16 public class Pdf2Swf
17 {
18 public Pdf2Swf()
19 {
20 //
21 // TODO: 在此处添加构造函数逻辑
22 //
23 }
24 public void PDFConvertToSWF(string sourcePath, string targetPath)
25 {
26 Process p = new Process();
27 p.StartInfo.FileName = "cmd.exe ";
28 p.StartInfo.UseShellExecute = false;
29 p.StartInfo.RedirectStandardInput = true;
30 p.StartInfo.RedirectStandardOutput = true;
31 p.StartInfo.RedirectStandardError = true;
32 p.StartInfo.CreateNoWindow = true;
33 p.Start();
34 string cmd = "pdf2swf.exe" + " " + sourcePath + " -o " + targetPath;
35 p.StandardInput.WriteLine(cmd);
36 p.Close();
37 }
38 }


需要知道转换过的java 代码应该怎么写
...全文
392 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wula0010 2015-08-13
  • 打赏
  • 举报
回复
string cmd = "pdf2swf.exe" + " " + sourcePath + " -o " + targetPath; 这是什么?就是运行一个cmd的命令? 如果是:

Process child = Runtime.getRuntime().exec(cmd);
// 获得输出
InputStream child_in = child.getInputStream();
String strReturn = "";

while ((c = child_in.read()) != -1) {
    strReturn += (char) c;
}
child_in.close();
tony4geek 2015-08-13
  • 打赏
  • 举报
回复
这个就是在cmd 中通过命令行执行 。 你平常打开记事本通过点击exe 图标执行,java 代码中通过cmd 执行上面 的操作
wula0010 2015-08-13
  • 打赏
  • 举报
回复
引用 3 楼 u011235913 的回复:
[quote=引用 1 楼 wula0010 的回复:] string cmd = "pdf2swf.exe" + " " + sourcePath + " -o " + targetPath; 这是什么?就是运行一个cmd的命令? 如果是:

Process child = Runtime.getRuntime().exec(cmd);
// 获得输出
InputStream child_in = child.getInputStream();
String strReturn = "";

while ((c = child_in.read()) != -1) {
    strReturn += (char) c;
}
child_in.close();
while ((c = child_in.read()) != -1) { strReturn += (char) c; } while语句中 C 代表什么??谢谢[/quote] int c;
  • 打赏
  • 举报
回复
引用 2 楼 rui888 的回复:
参考这个。
谢谢您。。每次都回复我的帖子
  • 打赏
  • 举报
回复
引用 1 楼 wula0010 的回复:
string cmd = "pdf2swf.exe" + " " + sourcePath + " -o " + targetPath; 这是什么?就是运行一个cmd的命令? 如果是:

Process child = Runtime.getRuntime().exec(cmd);
// 获得输出
InputStream child_in = child.getInputStream();
String strReturn = "";

while ((c = child_in.read()) != -1) {
    strReturn += (char) c;
}
child_in.close();
while ((c = child_in.read()) != -1) { strReturn += (char) c; } while语句中 C 代表什么??谢谢
tony4geek 2015-08-13
  • 打赏
  • 举报
回复

50,639

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧