This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/master by this push:
new 3c8969c Refactor
org.apache.commons.text.TextStringBuilder.readFrom(Readable) to split out
overrides.
3c8969c is described below
commit 3c8969c9b927ff9ae653bf32f3abb404e0dd71bc
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Jun 22 20:51:59 2020 -0400
Refactor org.apache.commons.text.TextStringBuilder.readFrom(Readable) to
split out overrides.
- TextStringBuilder.readFrom(CharBuffer)
- TextStringBuilder.readFrom(Reader)
- These are already tested.
---
src/main/java/org/apache/commons/text/TextStringBuilder.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java
b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index 6de3a0a..e75e153 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -481,12 +481,12 @@ public class TextStringBuilder implements CharSequence,
Appendable, Serializable
* @see #appendTo(Appendable)
*/
public int readFrom(final Readable readable) throws IOException {
- final int oldSize = size;
if (readable instanceof Reader) {
return readFrom((Reader) readable);
} else if (readable instanceof CharBuffer) {
return readFrom((CharBuffer) readable);
} else {
+ final int oldSize = size;
while (true) {
ensureCapacity(size + 1);
final CharBuffer buf = CharBuffer.wrap(buffer, size,
buffer.length - size);
@@ -496,8 +496,8 @@ public class TextStringBuilder implements CharSequence,
Appendable, Serializable
}
size += read;
}
+ return size - oldSize;
}
- return size - oldSize;
}
/**