关于java的文件流操作,将输入流存放到linux系统的/tmp目录下边的临时文件中public boolean insertData(String strFileId,String strFileName,int iFileSize,
InputStream fis) throws LogException
{
}
再从临时文件中读取private int readFile(String where,String strFileName,String strFileId,String strDestFile) 
throws LogException
{
}
请问如何写上述2个方法谢谢了
在线等

解决方案 »

  1.   

    File tmpFolder = new File("/tmp");
    if(!tmpFolder.exists() &&!tmpFolder.mkdirs()){ throw new IOException(" Can't create folder");File tmp = File.createTempFile(strFileName,tmpFolder);
    FileOutputStream fos = new FileOutputStream(tmp);// 写出数据。不知道 参数什么意思。读文件也是一样的方法。如果你那个 readFile 只是拷贝内容的话,用 NIO  通道 操作快些。
      

  2.   

    意思是这样的,通过web将图片文件等上传到server上,然后server写到临时目录,然后再读取这个文件发送给其他的程序.就是这个过程.