请大伙看看这两代码结果都还ok 就是不知道 效率更好些
第一段代码,实现写入本地
public File writeFile(String strUrl,String writeType, String handler,String orderNo)
			throws 
IOException {
		OutputStream os = null;
		File file=null;
		try {
			URL url = new URL(strUrl);
			InputStream is = url.openStream();			
			String value = null;
			value = SystemProperties.getSystemPropertie().getQnrPropertyValue("qunar.resultXML.dir");
			Tool.outputByConsole("出票接口请求返回XML文件保存路径:"+value);
			if(value !=null)
			{
				value = value.replace("\\", "/");
				if(value.lastIndexOf("/") == value.length()-1)
				{
					fileDir = value.substring(0,value.length()-1);
				}
				else
				{
					fileDir = value;
				}				
			}
			String	filePath = fileDir+"/"+writeType+"/"+Tool.date2Str(new Date(),Constant.DATE_PATTERN_NO_TIME);
			String fileName=Tool.date2Str(new Date(),Constant.DATE_PATTERN_NO_SPLIT)+handler+orderNo+"result.xml";
			file=new File(filePath+"/"+fileName);
			while(!file.exists()){				
				file.mkdirs();				
			}			
			os = new FileOutputStream(filePath + "/" + fileName);			
			int bytesRead = 0;
			byte[] buffer = new byte[8192];
			while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
				os.write(buffer, 0, bytesRead);
			}
		} catch (Exception e2) {
			e2.printStackTrace();
		} finally {
			if (os != null) {
				os.close();
			}			
		}
		return file;
	}
第二段代码,实现写入本地
public void writeIssXML(String filePath,String fileName,String contents) throws IOException {
		BufferedWriter writer = new BufferedWriter(new FileWriter(new File(filePath+"/"+fileName), true));
		writer.write(contents);
		writer.close();
	}
从代码量来看下面这个要简洁多嗒。。。。。 求指点
------解决方案--------------------这个...
没啥可比性的,因为代码2调用之前的代码没有,也就是代码2的filePath,fileName, contents是怎么来的?
------解决方案--------------------内容不大的情况下,没什么本质区别。
------解决方案--------------------
差不多。 看你这个文件大小。 大文件 必须要用多批次 形式