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;   

        }   

  • 相关阅读:
    人月神话阅读笔记01
    Map Reduce数据清洗及Hive数据库操作
    Hadoop实验六——MapReduce的操作
    假期第九周学习记录
    假期第八周学习记录
    假期第七周学习记录
    hadoop不在sudoers文件中。此事将被报告。 解决方法
    假期第六周学习记录
    2021寒假(22)
    2021寒假(21)
  • 原文地址:https://www.cnblogs.com/zhwl/p/2262079.html
Copyright © 2011-2022 走看看