2362N/A * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A // In order to handle surrogates properly we must never try to produce 0N/A // fewer than two characters at a time. If we're only asked to return one 0N/A // character then the other is saved here to be returned later. 0N/A // Factories for java.io.InputStreamReader 0N/A // Factory for java.nio.channels.Channels.newReader 0N/A // -- Public methods corresponding to those in InputStreamReader -- 0N/A // methods; the concrete stream-decoder subclasses defined below need not 0N/A // do any such checking. 0N/A // Return the leftover char, if there is one 0N/A // Convert more bytes 0N/A // Copy the leftover char into the buffer 0N/A // Return now if this is all we can produce w/o blocking 0N/A // Treat single-character array reads just like read() 0N/A return (n ==
0) ? -
1 : n;
0N/A // -- Charset-based stream decoder impl -- 0N/A // In the early stages of the build we haven't yet built the NIO native 0N/A // code, so guard against that by catching the first UnsatisfiedLinkError 0N/A // and setting this flag so that later attempts fail quickly. 0N/A // Exactly one of these is non-null 0N/A // This path disabled until direct buffers are faster 0N/A // Read from the channel 0N/A // Read from the input stream, and then update the buffer 0N/A assert (n <=
rem) :
"n = " + n +
", rem = " +
rem;
0N/A // Flip even when an IOException is thrown, 0N/A // otherwise the stream will stutter 0N/A // In order to handle surrogate pairs, this method requires that 0N/A // the invoker attempt to read at least two characters. Saving the 0N/A // extra character, if any, at a higher level is easier than trying 0N/A // to deal with it here. 0N/A // Ensure that cb[0] == cbuf[off] 0N/A break;
// Block at most once 0N/A // ## Need to flush decoder