class FileSystemUtil {

    public static void updateFileHandle(File inputFile, String contentTobeAdded, boolean isClose)
            throws IOException {

        List<FileWriter> fileWriterStore = new ArrayList<>();

        FileWriter fileWriter = new FileWriter(inputFile, true);
        fileWriterStore.add(fileWriter);
        PrintWriter outputPrintWriter = new PrintWriter(fileWriter, true);
        if (!isClose) {
            outputPrintWriter.write(contentTobeAdded);
            outputPrintWriter.flush();
            outputPrintWriter.close();
        } else {
            for (FileWriter curWriter : fileWriterStore) {
                curWriter.flush();
                curWriter.close();
                curWriter = null;
            }
        }
    }

    private  FileSystemUtil();

}