mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8279946: (ch) java.nio.channels.FileChannel tryLock and write methods are missing @throws NonWritableChannelException
Reviewed-by: alanb
This commit is contained in:
parent
674a97b27e
commit
f4575e4052
1 changed files with 28 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,13 +25,16 @@
|
||||||
|
|
||||||
package java.nio.channels;
|
package java.nio.channels;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.MappedByteBuffer;
|
import java.nio.MappedByteBuffer;
|
||||||
import java.nio.channels.spi.AbstractInterruptibleChannel;
|
import java.nio.channels.spi.AbstractInterruptibleChannel;
|
||||||
import java.nio.file.*;
|
import java.nio.file.FileAlreadyExistsException;
|
||||||
|
import java.nio.file.OpenOption;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.nio.file.attribute.FileAttribute;
|
import java.nio.file.attribute.FileAttribute;
|
||||||
import java.nio.file.spi.*;
|
import java.nio.file.spi.FileSystemProvider;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -403,6 +406,9 @@ public abstract class FileChannel
|
||||||
* with the number of bytes actually written. Otherwise this method
|
* with the number of bytes actually written. Otherwise this method
|
||||||
* behaves exactly as specified by the {@link WritableByteChannel}
|
* behaves exactly as specified by the {@link WritableByteChannel}
|
||||||
* interface. </p>
|
* interface. </p>
|
||||||
|
*
|
||||||
|
* @throws NonWritableChannelException
|
||||||
|
* If this channel was not opened for writing
|
||||||
*/
|
*/
|
||||||
public abstract int write(ByteBuffer src) throws IOException;
|
public abstract int write(ByteBuffer src) throws IOException;
|
||||||
|
|
||||||
|
@ -417,6 +423,9 @@ public abstract class FileChannel
|
||||||
* with the number of bytes actually written. Otherwise this method
|
* with the number of bytes actually written. Otherwise this method
|
||||||
* behaves exactly as specified in the {@link GatheringByteChannel}
|
* behaves exactly as specified in the {@link GatheringByteChannel}
|
||||||
* interface. </p>
|
* interface. </p>
|
||||||
|
*
|
||||||
|
* @throws NonWritableChannelException
|
||||||
|
* If this channel was not opened for writing
|
||||||
*/
|
*/
|
||||||
public abstract long write(ByteBuffer[] srcs, int offset, int length)
|
public abstract long write(ByteBuffer[] srcs, int offset, int length)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
@ -431,6 +440,9 @@ public abstract class FileChannel
|
||||||
* with the number of bytes actually written. Otherwise this method
|
* with the number of bytes actually written. Otherwise this method
|
||||||
* behaves exactly as specified in the {@link GatheringByteChannel}
|
* behaves exactly as specified in the {@link GatheringByteChannel}
|
||||||
* interface. </p>
|
* interface. </p>
|
||||||
|
*
|
||||||
|
* @throws NonWritableChannelException
|
||||||
|
* If this channel was not opened for writing
|
||||||
*/
|
*/
|
||||||
public final long write(ByteBuffer[] srcs) throws IOException {
|
public final long write(ByteBuffer[] srcs) throws IOException {
|
||||||
return write(srcs, 0, srcs.length);
|
return write(srcs, 0, srcs.length);
|
||||||
|
@ -1030,7 +1042,7 @@ public abstract class FileChannel
|
||||||
* region
|
* region
|
||||||
*
|
*
|
||||||
* @throws NonReadableChannelException
|
* @throws NonReadableChannelException
|
||||||
* If {@code shared} is {@code true} this channel was not
|
* If {@code shared} is {@code true} but this channel was not
|
||||||
* opened for reading
|
* opened for reading
|
||||||
*
|
*
|
||||||
* @throws NonWritableChannelException
|
* @throws NonWritableChannelException
|
||||||
|
@ -1148,6 +1160,14 @@ public abstract class FileChannel
|
||||||
* blocked in this method and is attempting to lock an overlapping
|
* blocked in this method and is attempting to lock an overlapping
|
||||||
* region of the same file
|
* region of the same file
|
||||||
*
|
*
|
||||||
|
* @throws NonReadableChannelException
|
||||||
|
* If {@code shared} is {@code true} but this channel was not
|
||||||
|
* opened for reading
|
||||||
|
*
|
||||||
|
* @throws NonWritableChannelException
|
||||||
|
* If {@code shared} is {@code false} but this channel was not
|
||||||
|
* opened for writing
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If some other I/O error occurs
|
* If some other I/O error occurs
|
||||||
*
|
*
|
||||||
|
@ -1180,6 +1200,9 @@ public abstract class FileChannel
|
||||||
* blocked in this method and is attempting to lock an overlapping
|
* blocked in this method and is attempting to lock an overlapping
|
||||||
* region
|
* region
|
||||||
*
|
*
|
||||||
|
* @throws NonWritableChannelException
|
||||||
|
* If this channel was not opened for writing
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If some other I/O error occurs
|
* If some other I/O error occurs
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue