< prev index next >
src/java.base/share/classes/java/io/PushbackReader.java
Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea
*** 1,7 ****
/*
! * Copyright (c) 1996, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1996, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 45,55 ****
/**
* Creates a new pushback reader with a pushback buffer of the given size.
*
* @param in The reader from which characters will be read
* @param size The size of the pushback buffer
! * @exception IllegalArgumentException if {@code size <= 0}
*/
public PushbackReader(Reader in, int size) {
super(in);
if (size <= 0) {
throw new IllegalArgumentException("size <= 0");
--- 45,55 ----
/**
* Creates a new pushback reader with a pushback buffer of the given size.
*
* @param in The reader from which characters will be read
* @param size The size of the pushback buffer
! * @throws IllegalArgumentException if {@code size <= 0}
*/
public PushbackReader(Reader in, int size) {
super(in);
if (size <= 0) {
throw new IllegalArgumentException("size <= 0");
*** 77,87 ****
* Reads a single character.
*
* @return The character read, or -1 if the end of the stream has been
* reached
*
! * @exception IOException If an I/O error occurs
*/
public int read() throws IOException {
synchronized (lock) {
ensureOpen();
if (pos < buf.length)
--- 77,87 ----
* Reads a single character.
*
* @return The character read, or -1 if the end of the stream has been
* reached
*
! * @throws IOException If an I/O error occurs
*/
public int read() throws IOException {
synchronized (lock) {
ensureOpen();
if (pos < buf.length)
*** 99,110 ****
* @param len Maximum number of characters to read
*
* @return The number of characters read, or -1 if the end of the
* stream has been reached
*
! * @exception IOException If an I/O error occurs
! * @exception IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {
ensureOpen();
try {
--- 99,110 ----
* @param len Maximum number of characters to read
*
* @return The number of characters read, or -1 if the end of the
* stream has been reached
*
! * @throws IOException If an I/O error occurs
! * @throws IndexOutOfBoundsException {@inheritDoc}
*/
public int read(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {
ensureOpen();
try {
*** 144,154 ****
* pushback buffer. After this method returns, the next character to be read
* will have the value <code>(char)c</code>.
*
* @param c The int value representing a character to be pushed back
*
! * @exception IOException If the pushback buffer is full,
* or if some other I/O error occurs
*/
public void unread(int c) throws IOException {
synchronized (lock) {
ensureOpen();
--- 144,154 ----
* pushback buffer. After this method returns, the next character to be read
* will have the value <code>(char)c</code>.
*
* @param c The int value representing a character to be pushed back
*
! * @throws IOException If the pushback buffer is full,
* or if some other I/O error occurs
*/
public void unread(int c) throws IOException {
synchronized (lock) {
ensureOpen();
*** 167,177 ****
*
* @param cbuf Character array
* @param off Offset of first character to push back
* @param len Number of characters to push back
*
! * @exception IOException If there is insufficient room in the pushback
* buffer, or if some other I/O error occurs
*/
public void unread(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {
ensureOpen();
--- 167,177 ----
*
* @param cbuf Character array
* @param off Offset of first character to push back
* @param len Number of characters to push back
*
! * @throws IOException If there is insufficient room in the pushback
* buffer, or if some other I/O error occurs
*/
public void unread(char cbuf[], int off, int len) throws IOException {
synchronized (lock) {
ensureOpen();
*** 188,208 ****
* read will have the value <code>cbuf[0]</code>, the character after that
* will have the value <code>cbuf[1]</code>, and so forth.
*
* @param cbuf Character array to push back
*
! * @exception IOException If there is insufficient room in the pushback
* buffer, or if some other I/O error occurs
*/
public void unread(char cbuf[]) throws IOException {
unread(cbuf, 0, cbuf.length);
}
/**
* Tells whether this stream is ready to be read.
*
! * @exception IOException If an I/O error occurs
*/
public boolean ready() throws IOException {
synchronized (lock) {
ensureOpen();
return (pos < buf.length) || super.ready();
--- 188,208 ----
* read will have the value <code>cbuf[0]</code>, the character after that
* will have the value <code>cbuf[1]</code>, and so forth.
*
* @param cbuf Character array to push back
*
! * @throws IOException If there is insufficient room in the pushback
* buffer, or if some other I/O error occurs
*/
public void unread(char cbuf[]) throws IOException {
unread(cbuf, 0, cbuf.length);
}
/**
* Tells whether this stream is ready to be read.
*
! * @throws IOException If an I/O error occurs
*/
public boolean ready() throws IOException {
synchronized (lock) {
ensureOpen();
return (pos < buf.length) || super.ready();
*** 211,231 ****
/**
* Marks the present position in the stream. The <code>mark</code>
* for class <code>PushbackReader</code> always throws an exception.
*
! * @exception IOException Always, since mark is not supported
*/
public void mark(int readAheadLimit) throws IOException {
throw new IOException("mark/reset not supported");
}
/**
* Resets the stream. The <code>reset</code> method of
* <code>PushbackReader</code> always throws an exception.
*
! * @exception IOException Always, since reset is not supported
*/
public void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
--- 211,231 ----
/**
* Marks the present position in the stream. The <code>mark</code>
* for class <code>PushbackReader</code> always throws an exception.
*
! * @throws IOException Always, since mark is not supported
*/
public void mark(int readAheadLimit) throws IOException {
throw new IOException("mark/reset not supported");
}
/**
* Resets the stream. The <code>reset</code> method of
* <code>PushbackReader</code> always throws an exception.
*
! * @throws IOException Always, since reset is not supported
*/
public void reset() throws IOException {
throw new IOException("mark/reset not supported");
}
*** 242,252 ****
* it. Once the stream has been closed, further read(),
* unread(), ready(), or skip() invocations will throw an IOException.
* Closing a previously closed stream has no effect. This method will block
* while there is another thread blocking on the reader.
*
! * @exception IOException If an I/O error occurs
*/
public void close() throws IOException {
synchronized (lock) {
super.close();
buf = null;
--- 242,252 ----
* it. Once the stream has been closed, further read(),
* unread(), ready(), or skip() invocations will throw an IOException.
* Closing a previously closed stream has no effect. This method will block
* while there is another thread blocking on the reader.
*
! * @throws IOException If an I/O error occurs
*/
public void close() throws IOException {
synchronized (lock) {
super.close();
buf = null;
*** 259,270 ****
*
* @param n The number of characters to skip
*
* @return The number of characters actually skipped
*
! * @exception IllegalArgumentException If <code>n</code> is negative.
! * @exception IOException If an I/O error occurs
*/
public long skip(long n) throws IOException {
if (n < 0L)
throw new IllegalArgumentException("skip value is negative");
synchronized (lock) {
--- 259,270 ----
*
* @param n The number of characters to skip
*
* @return The number of characters actually skipped
*
! * @throws IllegalArgumentException If <code>n</code> is negative.
! * @throws IOException If an I/O error occurs
*/
public long skip(long n) throws IOException {
if (n < 0L)
throw new IllegalArgumentException("skip value is negative");
synchronized (lock) {
< prev index next >