zoukankan      html  css  js  c++  java
  • 把字节数组保存为一个文件

    /** 

         * 把字节数组保存为一个文件  

         * @EditTime 2007-8-13 上午11:45:56  

         */   

        public static File getFileFromBytes(byte[] b, String outputFile) {   

            BufferedOutputStream stream = null;   

            File file = null;   

            try {   

                file = new File(outputFile);   

                FileOutputStream fstream = new FileOutputStream(file);   

                stream = new BufferedOutputStream(fstream);   

                stream.write(b);   

            } catch (Exception e) {   

                e.printStackTrace();   

            } finally {   

                if (stream != null) {   

                    try {   

                        stream.close();   

                    } catch (IOException e1) {   

                        e1.printStackTrace();   

                    }   

                }   

            }   

            return file;   

        }   

  • 相关阅读:
    PV、UV、VV、IP是什么意思?
    多用户远程linux
    实用性阅读指南读书笔记
    在VS添加万能头文件 操作
    sqrt函数实现之卡马克方法
    大端法、小端法及其判断方法
    STL源码剖析之ROUND_UP函数实现原理及其拓展
    海康和多益面经
    小米实习生面试面经
    阿里c++一面面经
  • 原文地址:https://www.cnblogs.com/zhwl/p/2262079.html
Copyright © 2011-2022 走看看