Skip to content

Commit

Permalink
Fixed FileChannel.open
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Paulsen committed Dec 6, 2024
1 parent b90bc0d commit 0698d5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ static ElementMatcher<MethodDescription> getMethodsMatcher(
"java.io.BufferedReader",
List.of("lines"),
"java.nio.channels.FileChannel",
List.of("open")
List.of("open"),
"java.nio.file.spi.FileSystemProvider",
List.of("newFileChannel")
);
//</editor-fold>

Expand All @@ -167,9 +169,7 @@ static ElementMatcher<MethodDescription> getMethodsMatcher(
"java.nio.file.Files",
List.of("write", "writeString", "newOutputStream", "writeBytes", "writeAllBytes", "writeLines"),
"java.io.File",
List.of("setWritable"),
"java.nio.channels.FileChannel",
List.of("open")
List.of("setWritable")

);
//</editor-fold>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public static void accessFileSystemViaPrintStream() throws FileNotFoundException
* Access the file system using the {@link FileChannel} class for writing.
*/
public static void accessFileSystemViaFileChannelWrite() throws IOException {
FileChannel fileChannel = FileChannel.open(Path.of("pom123.xml"));
FileChannel fileChannel = FileChannel.open(Path.of("pom123.xml"), StandardOpenOption.WRITE);
fileChannel.write(ByteBuffer.allocate(10));
}

Expand Down

0 comments on commit 0698d5e

Please sign in to comment.