common_helper/src/main/java/com/xiongyingqi/util/FileHelper.java
public static File writeBytesToFile(byte[] data, File file) {
        try {
            validateFile(file);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        FileOutputStream outputStream = null;
        try {
            outputStream = new FileOutputStream(file);
            outputStream.write(data);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            LOGGER.error(e);
        } catch (IOException e) {
            e.printStackTrace();
            LOGGER.error(e);
        } finally {
            if (outputStream != null) {
                try {
                    outputStream.flush();
                    outputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    LOGGER.error(e);
                }
            }
        }
        return file;

    }
public static File writeBytesToFile(byte[] data, File file) {
        try {
            validateFile(file);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        FileOutputStream outputStream = null;
        try {
            outputStream = new FileOutputStream(file);
            outputStream.write(data);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            LOGGER.error(e);
        } catch (IOException e) {
            e.printStackTrace();
            LOGGER.error(e);
        } finally {
            if (outputStream != null) {
                try {
                    outputStream.flush();
                    outputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    LOGGER.error(e);
                }
            }
        }
        return file;

    }
public static File writeBytesToFile ( byte [ ] data , File file ) { try { validateFile ( file ) ; } catch ( Exception e1 ) { e1 . printStackTrace ( ) ; } FileOutputStream outputStream = null ; try { outputStream = new FileOutputStream ( file ) ; outputStream . write ( data ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; LOGGER . error ( e ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; LOGGER . error ( e ) ; } finally { if ( outputStream != null ) { try { outputStream . flush ( ) ; outputStream . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; LOGGER . error ( e ) ; } } } return file ; }
将字节组写入文件 <br>
2013-9-3 下午2:39:21

@param data
@param file
将字节组写入文件 <br > 2013 - 9 - 3 下午2 : 39 : 21