今天想通过数据库转移文件,想到java的流来进行处理。先读取文件生成流再把流专业后,再将流中的数据生成文件。
package word;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;


public class TestDoc
{

public static void main(String args[])
{
int bytesum=0;
int byteread=0;
InputStream inStream;

try
{
inStream = new FileInputStream("c:/1.xls");
FileOutputStream fs=new FileOutputStream("d:/aaa.xls");byte[] buffer =new byte[1444];
while ((byteread=inStream.read(buffer))!=-1)

{
bytesum+=byteread;
fs.write(buffer,0,byteread);
}
inStream.close();

} catch (Exception e)
{
e.printStackTrace();
}
}
}



































