mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
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
4 changed files with 46 additions and 23 deletions
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* 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()
|
||||
* operations may be costly, such as FileReaders and InputStreamReaders. For
|
||||
* therefore advisable to wrap a {@code BufferedReader} around any
|
||||
* {@code Reader} whose {@code read()} operations may be costly, such as
|
||||
* {@code FileReader}s and {@code InputStreamReader}s. For
|
||||
* example,
|
||||
*
|
||||
* {@snippet lang=java :
|
||||
|
@ -52,12 +53,18 @@ import jdk.internal.misc.InternalLock;
|
|||
* }
|
||||
*
|
||||
* will buffer the input from the specified file. Without buffering, each
|
||||
* invocation of read() or readLine() could cause bytes to be read from the
|
||||
* file, converted into characters, and then returned, which can be very
|
||||
* inefficient.
|
||||
* invocation of {@code read()} or {@code readLine()} could cause bytes to be
|
||||
* read from the file, converted into characters, and then returned, which can
|
||||
* be very inefficient.
|
||||
*
|
||||
* <p> Programs that use DataInputStreams for textual input can be localized by
|
||||
* replacing each DataInputStream with an appropriate BufferedReader.
|
||||
* <p> Programs that use {@code DataInputStream}s for textual input can be
|
||||
* 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 InputStreamReader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue