1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
397 * {@code '\n'}, then that is discarded also; reading then
398 * ceases. If end of file is encountered before either of the
399 * characters {@code '\n'} and {@code '\r'} is
400 * encountered, reading ceases. Once reading has ceased, a
401 * {@code String} is returned that contains all the
402 * characters read and not discarded, taken in order. Note that
403 * every character in this string will have a value less than
404 * <code>\u0100</code>, that is, {@code (char)256}.
405 *
406 * <p> The bit offset within the stream is reset to zero before
407 * the read occurs.
408 *
409 * @return a String containing a line of text from the stream.
410 *
411 * @exception IOException if an I/O error occurs.
412 */
413 String readLine() throws IOException;
414
415 /**
416 * Reads in a string that has been encoded using a
417 * <a href="../../../java/io/DataInput.html#modified-utf-8">modified
418 * UTF-8</a>
419 * format. The general contract of {@code readUTF} is that
420 * it reads a representation of a Unicode character string encoded
421 * in modified UTF-8 format; this string of characters is
422 * then returned as a {@code String}.
423 *
424 * <p> First, two bytes are read and used to construct an unsigned
425 * 16-bit integer in the manner of the
426 * {@code readUnsignedShort} method, using network byte order
427 * (regardless of the current byte order setting). This integer
428 * value is called the <i>UTF length</i> and specifies the number
429 * of additional bytes to be read. These bytes are then converted
430 * to characters by considering them in groups. The length of each
431 * group is computed from the value of the first byte of the
432 * group. The byte following a group, if any, is the first byte of
433 * the next group.
434 *
435 * <p> If the first byte of a group matches the bit pattern
436 * {@code 0xxxxxxx} (where {@code x} means "may be
437 * {@code 0} or {@code 1}"), then the group consists of
438 * just that byte. The byte is zero-extended to form a character.
|
1 /*
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
397 * {@code '\n'}, then that is discarded also; reading then
398 * ceases. If end of file is encountered before either of the
399 * characters {@code '\n'} and {@code '\r'} is
400 * encountered, reading ceases. Once reading has ceased, a
401 * {@code String} is returned that contains all the
402 * characters read and not discarded, taken in order. Note that
403 * every character in this string will have a value less than
404 * <code>\u0100</code>, that is, {@code (char)256}.
405 *
406 * <p> The bit offset within the stream is reset to zero before
407 * the read occurs.
408 *
409 * @return a String containing a line of text from the stream.
410 *
411 * @exception IOException if an I/O error occurs.
412 */
413 String readLine() throws IOException;
414
415 /**
416 * Reads in a string that has been encoded using a
417 * <a href="../../../../java.base/java/io/DataInput.html#modified-utf-8">
418 * modifiedUTF-8</a>
419 * format. The general contract of {@code readUTF} is that
420 * it reads a representation of a Unicode character string encoded
421 * in modified UTF-8 format; this string of characters is
422 * then returned as a {@code String}.
423 *
424 * <p> First, two bytes are read and used to construct an unsigned
425 * 16-bit integer in the manner of the
426 * {@code readUnsignedShort} method, using network byte order
427 * (regardless of the current byte order setting). This integer
428 * value is called the <i>UTF length</i> and specifies the number
429 * of additional bytes to be read. These bytes are then converted
430 * to characters by considering them in groups. The length of each
431 * group is computed from the value of the first byte of the
432 * group. The byte following a group, if any, is the first byte of
433 * the next group.
434 *
435 * <p> If the first byte of a group matches the bit pattern
436 * {@code 0xxxxxxx} (where {@code x} means "may be
437 * {@code 0} or {@code 1}"), then the group consists of
438 * just that byte. The byte is zero-extended to form a character.
|