BufferedReader : Employ the same resizing strategy as BufferedIS.
Change-Id: Ic0f1e53d514cde59783964efa88839f0446b9982
diff --git a/ojluni/src/main/java/java/io/BufferedReader.java b/ojluni/src/main/java/java/io/BufferedReader.java
index 51a6073..6225408 100755
--- a/ojluni/src/main/java/java/io/BufferedReader.java
+++ b/ojluni/src/main/java/java/io/BufferedReader.java
@@ -139,7 +139,17 @@
dst = delta;
} else {
/* Reallocate buffer to accommodate read-ahead limit */
- char ncb[] = new char[readAheadLimit];
+ //
+ // Android changed : Use the same strategy as BufferedInputStream,
+ // i.e, double the size of the buffer on each fill. Do not directly
+ // size the buffer to the readAheadLimit.
+ //
+ // char ncb[] = new char[readAheadLimit];
+ int nlength = cb.length * 2;
+ if (nlength > readAheadLimit) {
+ nlength = readAheadLimit;
+ }
+ char ncb[] = new char[nlength];
System.arraycopy(cb, markedChar, ncb, 0, delta);
cb = ncb;
markedChar = 0;