现在要做一个功能: 就是把word文档用证书进行加密,在网上传输,然后解密.
要把word文档里的内容全读出来存放到一个byte[]数组里,对byte[]数组加密后,
重新写回到word文档.
  问题: 在java中采用什么方式在读,写word文档里的内容.(文件只能是word文档,别的格式不考虑).
如有知道的,请告知,送上50分.

解决方案 »

  1.   

    FileInputStream fs = new FileInputStream("cc.word")
      

  2.   

    问题有点改变,,,应该是: 怎摸把
    1.  1个文件转变为一个2进制流,用byte[]数组存起来?
    2.  把一个byte[]数组里的内容,还原为文件1个转,,1个恢复.
      

  3.   

    FileOutputStream class  and  write method
      

  4.   

    import java.io.*;
    public class Test{
    public static void main(String[] args) throws IOException{
    BufferedInputStream input=new BufferedInputStream(new FileInputStream("d:/1.doc"));
    BufferedOutputStream output=new BufferedOutputStream(new FileOutputStream("d:/2.doc"));
    int fileLength=input.available();
    byte[] byteFile=new byte[fileLength];
                    //数据读到了byte数组中
    input.read(byteFile,0,fileLength);
    input.close();
                    //将其写入文件
    output.write(byteFile);
    output.close();
    }
    }

      

  5.   

    主要的是java.io包中类的使用.
      

  6.   

    3qs every one, but i will decide give score to xManic()
    haha~~~