8136738: InputStream documentation for IOException in skip() is unclear or incorrect
Summary: Clarify javadoc of skip().
Reviewed-by: rriggs, prappo
--- a/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Wed Jul 05 21:52:00 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Mon Jun 20 14:08:05 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -359,10 +359,10 @@
* See the general contract of the <code>skip</code>
* method of <code>InputStream</code>.
*
- * @exception IOException if the stream does not support seek,
- * or if this input stream has been closed by
- * invoking its {@link #close()} method, or an
- * I/O error occurs.
+ * @throws IOException if this input stream has been closed by
+ * invoking its {@link #close()} method,
+ * {@code in.skip(n)} throws an IOException,
+ * or an I/O error occurs.
*/
public synchronized long skip(long n) throws IOException {
getBufIfOpen(); // Check for closed stream
--- a/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Wed Jul 05 21:52:00 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Mon Jun 20 14:08:05 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -144,8 +144,7 @@
*
* @param n the number of bytes to be skipped.
* @return the actual number of bytes skipped.
- * @exception IOException if the stream does not support seek,
- * or if some other I/O error occurs.
+ * @throws IOException if {@code in.skip(n)} throws an IOException.
*/
public long skip(long n) throws IOException {
return in.skip(n);
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java Wed Jul 05 21:52:00 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java Mon Jun 20 14:08:05 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -325,7 +325,7 @@
* returns 0, and no bytes are skipped. Subclasses may handle the negative
* value differently.
*
- * <p> The <code>skip</code> method of this class creates a
+ * <p> The <code>skip</code> method implementation of this class creates a
* byte array and then repeatedly reads into it until <code>n</code> bytes
* have been read or the end of the stream has been reached. Subclasses are
* encouraged to provide a more efficient implementation of this method.
@@ -333,8 +333,7 @@
*
* @param n the number of bytes to be skipped.
* @return the actual number of bytes skipped.
- * @exception IOException if the stream does not support seek,
- * or if some other I/O error occurs.
+ * @throws IOException if an I/O error occurs.
*/
public long skip(long n) throws IOException {
--- a/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Wed Jul 05 21:52:00 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Mon Jun 20 14:08:05 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -291,10 +291,10 @@
*
* @param n {@inheritDoc}
* @return {@inheritDoc}
- * @exception IOException if the stream does not support seek,
- * or the stream has been closed by
- * invoking its {@link #close()} method,
- * or an I/O error occurs.
+ * @throws IOException if the stream has been closed by
+ * invoking its {@link #close()} method,
+ * {@code in.skip(n)} throws an IOException,
+ * or an I/O error occurs.
* @see java.io.FilterInputStream#in
* @see java.io.InputStream#skip(long n)
* @since 1.2