Code example for BufferedWriter

Methods: closeflushnewLineappend

0
        BufferedWriter bufferedWriter = null;
         
        try { 
             
            //Construct the BufferedWriter object 
            bufferedWriter = new BufferedWriter(new FileWriter(filename));
             
            //Start writing to the output stream 
            bufferedWriter.append(value);
            bufferedWriter.newLine();
             
        } catch (IOException ex) {
            ex.printStackTrace();
        } finally { 
            //Close the BufferedWriter 
            try { 
                if (bufferedWriter != null) {
                    bufferedWriter.flush();
                    bufferedWriter.close();
                } 
            } catch (IOException ex) {
                ex.printStackTrace();
            } 
        } 
Stop searching for code, let great code find you!  Add Codota to your java IDE