阅读背景:

Java写文件

来源:互联网 

	private void writeFile(String path, String content) {
		File file = null;
		FileOutputStream fos = null;
		try {
			file = new File(path);
			if (!file.exists()) {
				file.createNewFile();
			}
			// append if true, then bytes will be written to the end of the file rather than the beginning
			fos = new FileOutputStream(file, true);
			fos.write(content.getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (fos != null) {
					fos.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}	private void writeFile(String path, String conten




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: