 /*
 *
 * Autopsy Forensic Browser
 * 
 * Copyright 2012 42six Solutions.
 * Contact: aebadirad <at> 42six <dot> com
 * Project Contact/Architect: carrier <at> sleuthkit <dot> org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.sleuthkit.autopsy.report;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;


public class ReportUtils {

    static String changeExtension(String originalName, String newExtension) {
        int lastDot = originalName.lastIndexOf(".");
        if (lastDot != -1) {
            return originalName.substring(0, lastDot) + newExtension;
        } else {
            return originalName + newExtension;
        }
    }

    /**
 * Inserts a string into a string every n number of characters
 *
 * @param  text the base string/text that you want to have manipulated
 * @param  insert the string you want to insert
 * @param period how many characters it should input insert at
 * @return string with the string inserts inserted
 */
    public static String insertPeriodically(String text, String insert, int period) {
        StringBuilder builder = new StringBuilder(
                text.length() + insert.length() * (text.length() / period) + 1);

        int index = 0;
        String prefix = "";
        while (index < text.length()) {
            // Don't put the insert in the very first iteration.
            // This is easier than appending it *after* each substring
            builder.append(prefix);
            prefix = insert;
            builder.append(text.substring(index,
                    Math.min(index + period, text.length())));
            index += period;
        }
        return builder.toString();
    }

    public static void copy(InputStream in, OutputStream out) throws IOException {

        BufferedInputStream bin = new BufferedInputStream(in);
        BufferedOutputStream bout = new BufferedOutputStream(out);

        while (true) {
            int datum = bin.read();
            if (datum == -1) {
                break;
            }
            bout.write(datum);
        }
        bout.flush();
    }
}
@@ -781,168 +781,8 @@
 t;%0A%0A
-import java.io.BufferedInputStream;%0Aimport java.io.BufferedOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0A%0A%0A
 publ
@@ -2134,418 +2134,6 @@
    %7D
-%0A%0A    public static void copy(InputStream in, OutputStream out) throws IOException %7B%0A%0A        BufferedInputStream bin = new BufferedInputStream(in);%0A        BufferedOutputStream bout = new BufferedOutputStream(out);%0A%0A        while (true) %7B%0A            int datum = bin.read();%0A            if (datum == -1) %7B%0A                break;%0A            %7D%0A            bout.write(datum);%0A        %7D%0A        bout.flush();%0A    %7D
 %0A%7D

Remove ReportUtils.copy()