diff --git a/src/main/java/com/conveyal/r5/analyst/progress/ProgressInputStream.java b/src/main/java/com/conveyal/r5/analyst/progress/ProgressInputStream.java index b8efca7f8..417ae6de9 100644 --- a/src/main/java/com/conveyal/r5/analyst/progress/ProgressInputStream.java +++ b/src/main/java/com/conveyal/r5/analyst/progress/ProgressInputStream.java @@ -1,7 +1,6 @@ package com.conveyal.r5.analyst.progress; import com.conveyal.file.FileUtils; -import org.apache.commons.fileupload.FileItem; import org.apache.commons.io.input.ProxyInputStream; import java.io.File; @@ -15,7 +14,7 @@ * This will report progress as the total number of bytes that have passed through the stream, like CountingInputStream. * This can exceed 100% of the file size if the caller uses mark and reset. The progressListener should be * pre-configured with the total number of bytes expected and a detail message using ProgressListener::beginTask. - * The static method forFileItem() demonstrates usage when reading from a file of known length. + * The static method forFile() demonstrates usage when reading from a file of known length. */ public class ProgressInputStream extends ProxyInputStream { @@ -40,22 +39,6 @@ public synchronized long skip (final long length) throws IOException { return skippedBytes; } - /** - * Given an uploaded file, report progress on reading it. - * Incrementing the progress seems to introduce some inefficiency when performing unbuffered small reads, such as - * calls to InputStream.read() which are used by DataInputStream to read numbers. - * TODO wrap in buffered input stream to reduce small read calls, or tune to only report once per percentage? - */ - public static ProgressInputStream forFileItem (FileItem fileItem, ProgressListener progressListener) { - try { - checkArgument(fileItem.getSize() < Integer.MAX_VALUE); - progressListener.beginTask("Reading file " + fileItem.getName(), (int)(fileItem.getSize())); - return new ProgressInputStream(progressListener, fileItem.getInputStream()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - /** * Given an uploaded file, report progress on reading it. */