This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/main by this push:
     new ec61b76c1c Remove DockerServiceImpl.StreamUtils (#2648)
ec61b76c1c is described below

commit ec61b76c1c6c0d91e27e60fd00c068ec051546fd
Author: Robert Varga <[email protected]>
AuthorDate: Thu Jun 11 10:03:52 2026 +0200

    Remove DockerServiceImpl.StreamUtils (#2648)
    
    This entire class is only used to support a simple Files.copy()
    operation: convert the sole user and remove the class.
    
    Signed-off-by: Robert Varga <[email protected]>
---
 .../karaf/docker/internal/DockerServiceImpl.java   | 72 +++++++---------------
 1 file changed, 22 insertions(+), 50 deletions(-)

diff --git 
a/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java 
b/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
index e769eaf477..ca4315c381 100644
--- 
a/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
+++ 
b/docker/src/main/java/org/apache/karaf/docker/internal/DockerServiceImpl.java
@@ -16,12 +16,29 @@
  */
 package org.apache.karaf.docker.internal;
 
-import org.apache.karaf.docker.*;
-
-import java.io.*;
+import org.apache.karaf.docker.Container;
+import org.apache.karaf.docker.ContainerConfig;
+import org.apache.karaf.docker.DockerClient;
+import org.apache.karaf.docker.DockerService;
+import org.apache.karaf.docker.HostConfig;
+import org.apache.karaf.docker.HostPortBinding;
+import org.apache.karaf.docker.Image;
+import org.apache.karaf.docker.ImageHistory;
+import org.apache.karaf.docker.ImageSearch;
+import org.apache.karaf.docker.Info;
+import org.apache.karaf.docker.Top;
+import org.apache.karaf.docker.Version;
+
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.attribute.PosixFilePermission;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public class DockerServiceImpl implements DockerService {
 
@@ -377,53 +394,8 @@ public class DockerServiceImpl implements DockerService {
                 copy(new File(source, child), new File(destination, child));
             }
         } else {
-            try (
-                    InputStream in = new FileInputStream(source);
-                    OutputStream out = new FileOutputStream(destination)
-            ) {
-                new StreamUtils().copy(in, out);
-            }
-        }
-    }
-
-    class StreamUtils {
-
-        public StreamUtils() {
-        }
-
-        public void close(Closeable... closeables) {
-            for (Closeable c : closeables) {
-                try {
-                    if (c != null) {
-                        c.close();
-                    }
-                } catch (IOException e) {
-                    // Ignore
-                }
-            }
-        }
-
-        public void close(Iterable<Closeable> closeables) {
-            for (Closeable c : closeables) {
-                try {
-                    if (c != null) {
-                        c.close();
-                    }
-                } catch (IOException e) {
-                    // Ignore
-                }
-            }
+            Files.copy(source.toPath(), destination.toPath());
         }
-
-        public void copy(final InputStream input, final OutputStream output) 
throws IOException {
-            byte[] buffer = new byte[1024 * 16];
-            int n;
-            while ((n = input.read(buffer)) > 0) {
-                output.write(buffer, 0, n);
-            }
-            output.flush();
-        }
-
     }
 
     private static void makeFileExecutable(File serviceFile) throws 
IOException {

Reply via email to