public static File updateFile(String filename, String fileData) throws HyscaleException {
		if (StringUtils.isBlank(filename) || fileData == null) {
			throw new HyscaleException(CommonErrorCode.FAILED_TO_WRITE_FILE_DATA);
		}
		File file = new File(filename);
		// create parent dir if missing
		file.getParentFile().mkdirs();
		try (FileWriter fileWriter = new FileWriter(file, true)) {
			fileWriter.write(fileData);
		} catch (IOException e) {
 			logger.error("Failed to update file {}", filename, e);
			HyscaleException ex = new HyscaleException(e, CommonErrorCode.FAILED_TO_WRITE_FILE, filename);
			throw ex;
		}
		return file;
	}
Update/Create file in required directory

@param filename
@param fileData
@throws HyscaleException
commons/src/main/java/io/hyscale/commons/io/HyscaleFilesUtil.java