Skip to content

Commit

Permalink
Remove unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorgerhardt committed Oct 27, 2023
1 parent 45aac6d commit 943b84e
Showing 1 changed file with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

Expand All @@ -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.
*/
Expand Down

0 comments on commit 943b84e

Please sign in to comment.