java io 操作写入word - Java / Web 开发
public static void main(String[] args) throws Exception {
File file = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word.doc");
File file1 = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word1.doc");
File file2 = new File("D:/Tools/apache-tomcat-5.5.28/webapps/j2w/upload/word2.doc");
if (!file1.exists()) {
file1.createNewFile();
}
if (!file2.exists()) {
file2.createNewFile();
}
InputStream in = null;
InputStream in2 = null;
OutputStream out = null;
try {
// 一次读一个字节
in = new FileInputStream(file1);
in2 = new FileInputStream(file1);
out = new FileOutputStream(file);
SequenceInputStream sis = new SequenceInputStream(in, in2);
byte[] b = new byte[1];
while ((sis.read(b)) != -1) {
out.write(b);
}
out.flush();
in.close();
out.close();
} catch (Exception e) {
e.printStackTrace();
return;
}
}
问题是这样的:
共有三个word
A.doc、B.doc、C.doc
A,B都有值。C是空的。我想把A,B的内容给C。但是明显的看到了C的文件大小的确是变大了,但是里面的内容只有A的或者是B的。
还有用追加的方式。我也试过了,还是不行。知道的老鸟顶一下,解决立刻散分
我想把A。doc,B。doc的内容写入C。doc,但是没有成功,可以看到C的文件大小明显变大,但是里面的内容不正确
相关问答:
我JSP的页面是:
<%@ page language="java" contentType="text/html; charset=gb2312"
%>
<script>
function Save(){
xmlHttp=GetXmlHttpObject()
if(xmlHttp==nul ......
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 52 in the jsp file: /vip_info.jsp
ÕË cannot be resolved
49: <table border="1& ......
insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
请问大哥们这个sql 语句应该用Java里的那个数据库操作方法? ......
id name datetime
1 a 2010-05-13 10:15:00
2 b 2010-05-14 09:10:00
3 d 2010-05-14 10:10:00
如何将距离目前最近的那个记录的name 更新为“x”呢
谢谢咯 啊 呵呵
update table_n ......