使用与转换前相同的格式从bytearray写入文件

时间:2015-04-18 22:25:26

标签: android byte bytearray fileoutputstream

我有一个以bytearray形式保存在数据库中的文件。我想以转换为bytearray之前的相同格式将字节数组写入文件。例如,如果文件是docx我想写为docx。

试          {                 x =“/ sdcard”;                 x + =“/ temp.pdf”;

         FileOutputStream stream = new FileOutputStream(x); 
         try 
         {
            stream.write(array);
            stream.close();
         } 
         catch (IOException e)
         {
            e.printStackTrace();
         }
     }
     catch (FileNotFoundException e1) 
      { 
         e1.printStackTrace(); 
         x="";
      }

0 个答案:

没有答案