Question: Use Oracles Java API documentation to help you describe each of the following StandardOpenOption constants: APPEND, CREATE, READ, TRUNCATE_EXISTING, and WRITE. public static BufferedWriter new

Use Oracle’s Java API documentation to help you describe each of the following StandardOpenOption constants: APPEND, CREATE, READ, TRUNCATE_EXISTING, and WRITE.

public static BufferedWriter newBufferedWriter ( Path path. Charset cs. OpenOption... options) throws

public static BufferedWriter new Buffered Writer( Path path. Charset cs. OpenOption... options) throws IOException * BufferendWriteToFile.java * Dean & Dean * This writes a string through a buffer to a text file. import java.util.Scanner; import java.io.BufferedWriter; import java.nio.file.*; // Paths, Files, StandardOpenOption import java.nio.charset.Charset: public class Buffered WriteToFile public static void main(String[] args) Scanner stdIn new Scanner(System.in); String fileName, openOption; System.out.print("Enter filename: "); file Name stdin.nextLine(); System.out.print("Enter TRUNCATE EXISTING or APPEND: "); openOption std In.nextLine(); try (BufferedWriter fileOut = Files.newBufferedWriter( [ Paths.get(fileName). Charset.defaultCharset(). StandardOpenOption.CREATE, For a special character set, substitute: Charset.forName("set-name") StandardOpenOption.valueOf(open Option))) System.out.println("Enter a line of text: "); fileOut.write(std In.nextLine() + " "); // end try catch (Exception e) ) System.out.println(e.getClass()); System.out.println(e.getMessage()); // end main //end BufferedWriteToFile class

Step by Step Solution

3.34 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are descriptions for each of the StandardOpenOption constants using Oracles Java API documentation 1 APPEND This option is used to open a file for writing appending the data to the end of the fil... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!