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-imaging.git

commit ae481f900aeadaed9b5d4b12b49c861c5170b1bc
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed May 31 18:12:22 2023 -0400

    Inline one-liner
---
 src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java  | 4 ----
 src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java  | 4 ++--
 .../org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java   | 3 ++-
 .../org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java   | 3 ++-
 .../org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java   | 3 ++-
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java 
b/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
index cc831d5b..0d3c7764 100644
--- a/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
+++ b/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
@@ -91,10 +91,6 @@ public final class BinaryFunctions {
 
     }
 
-    public static byte[] toByteArray(final InputStream is) throws IOException {
-        return IOUtils.toByteArray(is);
-    }
-
     public static byte[] head(final byte[] bytes, int count) {
         if (count > bytes.length) {
             count = bytes.length;
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java 
b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
index a071dfbb..f6a2ae28 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.imaging.formats.jpeg;
 
-import static org.apache.commons.imaging.common.BinaryFunctions.toByteArray;
 import static 
org.apache.commons.imaging.common.BinaryFunctions.readAndVerifyBytes;
 import static org.apache.commons.imaging.common.BinaryFunctions.readByte;
 import static org.apache.commons.imaging.common.BinaryFunctions.readBytes;
@@ -30,6 +29,7 @@ import org.apache.commons.imaging.bytesource.ByteSource;
 import org.apache.commons.imaging.common.BinaryFileParser;
 import org.apache.commons.imaging.common.ByteConversions;
 import org.apache.commons.imaging.internal.Debug;
+import org.apache.commons.io.IOUtils;
 
 public class JpegUtils extends BinaryFileParser {
     public interface Visitor {
@@ -180,7 +180,7 @@ public class JpegUtils extends BinaryFileParser {
                         return;
                     }
 
-                    final byte[] imageData = toByteArray(is);
+                    final byte[] imageData = IOUtils.toByteArray(is);
                     visitor.visitSOS(marker, markerBytes, imageData);
                     break;
                 }
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java
index a0461b79..9800a26d 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java
@@ -27,6 +27,7 @@ import java.util.zip.InflaterInputStream;
 import org.apache.commons.imaging.ImagingException;
 import org.apache.commons.imaging.common.Allocator;
 import org.apache.commons.imaging.common.BinaryFunctions;
+import org.apache.commons.io.IOUtils;
 
 /**
  * The PNG iCCP chunk. If "present, the image samples conform to the color 
space represented by the embedded ICC
@@ -92,7 +93,7 @@ public class PngChunkIccp extends PngChunk {
             LOGGER.finest("bytes.length: " + bytes.length);
         }
 
-        uncompressedProfile = BinaryFunctions.toByteArray(new 
InflaterInputStream(new ByteArrayInputStream(compressedProfile)));
+        uncompressedProfile = IOUtils.toByteArray(new InflaterInputStream(new 
ByteArrayInputStream(compressedProfile)));
 
         if (LOGGER.isLoggable(Level.FINEST)) {
             LOGGER.finest("UncompressedProfile: " + bytes.length);
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
index 80baca8c..9bfd9c1c 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
@@ -26,6 +26,7 @@ import org.apache.commons.imaging.common.Allocator;
 import org.apache.commons.imaging.common.BinaryFunctions;
 import org.apache.commons.imaging.formats.png.PngConstants;
 import org.apache.commons.imaging.formats.png.PngText;
+import org.apache.commons.io.IOUtils;
 
 public class PngChunkItxt extends PngTextChunk {
 
@@ -79,7 +80,7 @@ public class PngChunkItxt extends PngTextChunk {
             final byte[] compressedText = 
Allocator.byteArray(compressedTextLength);
             System.arraycopy(bytes, index, compressedText, 0, 
compressedTextLength);
 
-            text = new String(BinaryFunctions.toByteArray(new 
InflaterInputStream(new ByteArrayInputStream(compressedText))), 
StandardCharsets.UTF_8);
+            text = new String(IOUtils.toByteArray(new InflaterInputStream(new 
ByteArrayInputStream(compressedText))), StandardCharsets.UTF_8);
 
         } else {
             text = new String(bytes, index, bytes.length - index, 
StandardCharsets.UTF_8);
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java
index 093dd5b0..68cdcb0f 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkZtxt.java
@@ -26,6 +26,7 @@ import org.apache.commons.imaging.common.Allocator;
 import org.apache.commons.imaging.common.BinaryFunctions;
 import org.apache.commons.imaging.formats.png.PngConstants;
 import org.apache.commons.imaging.formats.png.PngText;
+import org.apache.commons.io.IOUtils;
 
 public class PngChunkZtxt extends PngTextChunk {
 
@@ -48,7 +49,7 @@ public class PngChunkZtxt extends PngTextChunk {
         final byte[] compressedText = 
Allocator.byteArray(compressedTextLength);
         System.arraycopy(bytes, index, compressedText, 0, 
compressedTextLength);
 
-        text = new String(BinaryFunctions.toByteArray(new 
InflaterInputStream(new ByteArrayInputStream(compressedText))), 
StandardCharsets.ISO_8859_1);
+        text = new String(IOUtils.toByteArray(new InflaterInputStream(new 
ByteArrayInputStream(compressedText))), StandardCharsets.ISO_8859_1);
     }
 
     @Override

Reply via email to