23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * This code is free software; you can redistribute it and/or modify it
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * under the terms of the GNU General Public License version 2 only, as
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * published by the Free Software Foundation.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * This code is distributed in the hope that it will be useful, but WITHOUT
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * version 2 for more details (a copy is included in the LICENSE file that
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * accompanied this code).
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * You should have received a copy of the GNU General Public License version
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * 2 along with this work; if not, write to the Free Software Foundation,
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * or visit www.oracle.com if you need additional information or have any
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * questions.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee @bug 4090383
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee @summary Ensure that BufferedReader's read method will fill the target array
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee whenever possible
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * A simple Reader that is always ready but may read fewer than the
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee * requested number of characters
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee public int read(char[] cbuf, int off, int len) throws IOException {
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee for (int i = off; i < n; i++)
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee return true;
e642872b5a76c4c8654eaa68f64986a85c86ca37qiao * Test BufferedReader with an underlying source that always reads
e642872b5a76c4c8654eaa68f64986a85c86ca37qiao * shortFall fewer characters than requested
e642872b5a76c4c8654eaa68f64986a85c86ca37qiao Reader r = new BufferedReader(new Source(shortFall), 10);