将byte数组写进文件,指定buffer size

public void save2File(String filePath, byte[] data) {  
		   	  
		        BufferedOutputStream bufferOutput = null;  
		  
		        try {  
		            bufferOutput = new BufferedOutputStream(new FileOutputStream(  
		                    new File(filePath)), 1024);  
		  
		            bufferOutput.write(data);  
		            bufferOutput.flush();  
		        } catch (Exception e) {  
		            throw new RuntimeException(e);  
		        } finally {  
		            if (bufferOutput != null) {  
		                try {  
		                    bufferOutput.close();  
		                } catch (Exception e) {  
		                    throw new RuntimeException(e);  
		                }  
		            }  
		        }  
		    }

你可能感兴趣的:(IO,将byte数组写进文件)