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-io.git
The following commit(s) were added to refs/heads/master by this push: new 72d53cf No need to allocate empty byte arrays over and over. 72d53cf is described below commit 72d53cf242788510de904c0c239d8804fc73c2dd Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Dec 25 11:45:48 2019 -0500 No need to allocate empty byte arrays over and over. --- src/main/java/org/apache/commons/io/IOUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/io/IOUtils.java b/src/main/java/org/apache/commons/io/IOUtils.java index f484c03..23927e1 100644 --- a/src/main/java/org/apache/commons/io/IOUtils.java +++ b/src/main/java/org/apache/commons/io/IOUtils.java @@ -105,6 +105,8 @@ public class IOUtils { // Writer. Each method should take at least one of these as a parameter, // or return one of them. + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + /** * The default buffer size ({@value}) to use in copy methods. */ @@ -2233,7 +2235,7 @@ public class IOUtils { } if (size == 0) { - return new byte[0]; + return EMPTY_BYTE_ARRAY; } final byte[] data = new byte[size];