OpenOption
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eOpenOption\u003c/code\u003e is an interface used to configure how files are opened or created in Java NIO.\u003c/p\u003e\n"],["\u003cp\u003eIt is used by methods in \u003ccode\u003eFiles\u003c/code\u003e, \u003ccode\u003eFileChannel\u003c/code\u003e, and \u003ccode\u003eAsynchronousFileChannel\u003c/code\u003e for file operations.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStandardOpenOption\u003c/code\u003e and \u003ccode\u003eLinkOption\u003c/code\u003e are implementations of \u003ccode\u003eOpenOption\u003c/code\u003e providing options for standard operations and symbolic link handling, respectively.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStandardOpenOption\u003c/code\u003e defines common options like \u003ccode\u003eCREATE\u003c/code\u003e, \u003ccode\u003eAPPEND\u003c/code\u003e, and \u003ccode\u003eREAD\u003c/code\u003e, while \u003ccode\u003eLinkOption\u003c/code\u003e controls whether symbolic links are followed.\u003c/p\u003e\n"]]],["`OpenOption` is an interface used to configure file opening or creation. It's employed by methods like `newOutputStream`, `newByteChannel`, `FileChannel.open`, and `AsynchronousFileChannel.open`. Key subclasses include `LinkOption`, which manages symbolic link handling, and `StandardOpenOption`, which defines standard open options. The `StandardOpenOption` enumeration specifies the *standard* options when interacting with files.\n"],null,["public interface **OpenOption** \n\n|---|---|---|\n| Known Indirect Subclasses [LinkOption](../../../../reference/java/nio/file/LinkOption.html), [StandardOpenOption](../../../../reference/java/nio/file/StandardOpenOption.html) |-----------------------------------------------------------------------------------|-----------------------------------------------------------| | [LinkOption](../../../../reference/java/nio/file/LinkOption.html) | Defines the options as to how symbolic links are handled. | | [StandardOpenOption](../../../../reference/java/nio/file/StandardOpenOption.html) | Defines the standard open options. | |||\n\nAn object that configures how to open or create a file.\n\nObjects of this type are used by methods such as [newOutputStream](../../../../reference/java/nio/file/Files.html#newOutputStream(java.nio.file.Path,%20java.nio.file.OpenOption...)), [newByteChannel](../../../../reference/java/nio/file/Files.html#newByteChannel(java.nio.file.Path,%20java.nio.file.OpenOption...)), [FileChannel.open](../../../../reference/java/nio/channels/FileChannel.html#open(java.nio.file.Path,%20java.nio.file.OpenOption...)), and [AsynchronousFileChannel.open](../../../../reference/java/nio/channels/AsynchronousFileChannel.html#open(java.nio.file.Path,%20java.nio.file.OpenOption...))\nwhen opening or creating a file.\n\nThe [StandardOpenOption](../../../../reference/java/nio/file/StandardOpenOption.html) enumeration type defines the\n*standard* options."]]