private void mergeFiles()

in build-tools/src/main/java/co/elastic/otel/android/compilation/tools/tasks/NoticeMergerTask.java [48:66]


    private void mergeFiles(List<ArtifactNoticeInfo> artifacts, File into) throws IOException {
        OutputStream out = new FileOutputStream(into);
        byte[] buf = new byte[1024 * 8];
        boolean firstIteration = true;
        for (ArtifactNoticeInfo artifact : artifacts) {
            if (!firstIteration) {
                addSeparator(out);
            } else {
                firstIteration = false;
            }
            TextUtils.writeText(out, artifact.id.getDisplayName() + " NOTICE\n\n");
            InputStream in = new FileInputStream(artifact.noticeFile);
            int b;
            while ((b = in.read(buf)) >= 0)
                out.write(buf, 0, b);
            in.close();
        }
        out.close();
    }