Tweak test script no issue #
[arvados.git] / src / main / java / org / arvados / client / utils / FileMerge.java
1 /*
2  * Copyright (C) The Arvados Authors. All rights reserved.
3  *
4  * SPDX-License-Identifier: AGPL-3.0 OR Apache-2.0
5  *
6  */
7
8 package org.arvados.client.utils;
9
10 import java.io.BufferedOutputStream;
11 import java.io.File;
12 import java.io.FileOutputStream;
13 import java.io.IOException;
14 import java.nio.file.Files;
15 import java.util.Collection;
16
17 public class FileMerge {
18
19     public static void merge(Collection<File> files, File targetFile) throws IOException {
20         try (FileOutputStream fos = new FileOutputStream(targetFile); BufferedOutputStream mergingStream = new BufferedOutputStream(fos)) {
21             for (File file : files) {
22                 Files.copy(file.toPath(), mergingStream);
23             }
24         }
25     }
26 }