8336895: BufferedReader doesn't read full \r\n line ending when it doesn't fit in buffer
Reviewed-by: jpai, alanb
This commit is contained in:
parent
376056ca48
commit
aeaa4f78eb
@ -50,6 +50,11 @@ import jdk.internal.util.ArraysSupport;
|
|||||||
* reread before new bytes are taken from
|
* reread before new bytes are taken from
|
||||||
* the contained input stream.
|
* the contained input stream.
|
||||||
*
|
*
|
||||||
|
* @apiNote
|
||||||
|
* Once wrapped in a {@code BufferedInputStream}, the underlying
|
||||||
|
* {@code InputStream} should not be used directly nor wrapped with
|
||||||
|
* another stream.
|
||||||
|
*
|
||||||
* @author Arthur van Hoff
|
* @author Arthur van Hoff
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -35,6 +35,11 @@ import jdk.internal.misc.VM;
|
|||||||
* output stream without necessarily causing a call to the underlying
|
* output stream without necessarily causing a call to the underlying
|
||||||
* system for each byte written.
|
* system for each byte written.
|
||||||
*
|
*
|
||||||
|
* @apiNote
|
||||||
|
* Once wrapped in a {@code BufferedOutputStream}, the underlying
|
||||||
|
* {@code OutputStream} should not be used directly nor wrapped with
|
||||||
|
* another stream.
|
||||||
|
*
|
||||||
* @author Arthur van Hoff
|
* @author Arthur van Hoff
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -43,8 +43,9 @@ import jdk.internal.misc.InternalLock;
|
|||||||
*
|
*
|
||||||
* <p> In general, each read request made of a Reader causes a corresponding
|
* <p> In general, each read request made of a Reader causes a corresponding
|
||||||
* read request to be made of the underlying character or byte stream. It is
|
* read request to be made of the underlying character or byte stream. It is
|
||||||
* therefore advisable to wrap a BufferedReader around any Reader whose read()
|
* therefore advisable to wrap a {@code BufferedReader} around any
|
||||||
* operations may be costly, such as FileReaders and InputStreamReaders. For
|
* {@code Reader} whose {@code read()} operations may be costly, such as
|
||||||
|
* {@code FileReader}s and {@code InputStreamReader}s. For
|
||||||
* example,
|
* example,
|
||||||
*
|
*
|
||||||
* {@snippet lang=java :
|
* {@snippet lang=java :
|
||||||
@ -52,12 +53,18 @@ import jdk.internal.misc.InternalLock;
|
|||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* will buffer the input from the specified file. Without buffering, each
|
* will buffer the input from the specified file. Without buffering, each
|
||||||
* invocation of read() or readLine() could cause bytes to be read from the
|
* invocation of {@code read()} or {@code readLine()} could cause bytes to be
|
||||||
* file, converted into characters, and then returned, which can be very
|
* read from the file, converted into characters, and then returned, which can
|
||||||
* inefficient.
|
* be very inefficient.
|
||||||
*
|
*
|
||||||
* <p> Programs that use DataInputStreams for textual input can be localized by
|
* <p> Programs that use {@code DataInputStream}s for textual input can be
|
||||||
* replacing each DataInputStream with an appropriate BufferedReader.
|
* localized by replacing each {@code DataInputStream} with an appropriate
|
||||||
|
* {@code BufferedReader}.
|
||||||
|
*
|
||||||
|
* @apiNote
|
||||||
|
* Once wrapped in a {@code BufferedReader}, the underlying
|
||||||
|
* {@code Reader} should not be used directly nor wrapped with
|
||||||
|
* another reader.
|
||||||
*
|
*
|
||||||
* @see FileReader
|
* @see FileReader
|
||||||
* @see InputStreamReader
|
* @see InputStreamReader
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -37,25 +37,31 @@ import jdk.internal.misc.VM;
|
|||||||
* <p> The buffer size may be specified, or the default size may be accepted.
|
* <p> The buffer size may be specified, or the default size may be accepted.
|
||||||
* The default is large enough for most purposes.
|
* The default is large enough for most purposes.
|
||||||
*
|
*
|
||||||
* <p> A newLine() method is provided, which uses the platform's own notion of
|
* <p> A {@code newLine()} method is provided, which uses the platform's own
|
||||||
* line separator as defined by the system property {@code line.separator}.
|
* notion of line separator as defined by the system property
|
||||||
* Not all platforms use the newline character ('\n') to terminate lines.
|
* {@linkplain System#lineSeparator() line.separator}. Not all platforms use the newline character ('\n')
|
||||||
* Calling this method to terminate each output line is therefore preferred to
|
* to terminate lines. Calling this method to terminate each output line is
|
||||||
* writing a newline character directly.
|
* therefore preferred to writing a newline character directly.
|
||||||
*
|
*
|
||||||
* <p> In general, a Writer sends its output immediately to the underlying
|
* <p> In general, a {@code Writer} sends its output immediately to the
|
||||||
* character or byte stream. Unless prompt output is required, it is advisable
|
* underlying character or byte stream. Unless prompt output is required, it
|
||||||
* to wrap a BufferedWriter around any Writer whose write() operations may be
|
* is advisable to wrap a {@code BufferedWriter} around any {@code Writer} whose
|
||||||
* costly, such as FileWriters and OutputStreamWriters. For example,
|
* {@code write()} operations may be costly, such as {@code FileWriter}s and
|
||||||
|
* {@code OutputStreamWriter}s. For example,
|
||||||
*
|
*
|
||||||
* {@snippet lang=java :
|
* {@snippet lang=java :
|
||||||
* PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
|
* PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* will buffer the PrintWriter's output to the file. Without buffering, each
|
* will buffer the {@code PrintWriter}'s output to the file. Without buffering,
|
||||||
* invocation of a print() method would cause characters to be converted into
|
* each invocation of a {@code print()} method would cause characters to be
|
||||||
* bytes that would then be written immediately to the file, which can be very
|
* converted into bytes that would then be written immediately to the file,
|
||||||
* inefficient.
|
* which can be very inefficient.
|
||||||
|
*
|
||||||
|
* @apiNote
|
||||||
|
* Once wrapped in a {@code BufferedWriter}, the underlying
|
||||||
|
* {@code Writer} should not be used directly nor wrapped with
|
||||||
|
* another writer.
|
||||||
*
|
*
|
||||||
* @see PrintWriter
|
* @see PrintWriter
|
||||||
* @see FileWriter
|
* @see FileWriter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user