Read input size from FormatInputStream instead of file
@@ -70,7 +70,7 @@ public class Runner {
Optional.ofNullable(commandLineArgs.getFile()),
commandLineArgs.getAddRootElementToXml());
-
+ double inputSizeMb = ((double) formatInputStream.getInputStream().available()) / 1024.0 / 1024.0;
int intervalOfLogging = commandLineArgs.getVerbose()
? commandLineArgs.getWhenVerboseEnabledPrintMessageForEveryXDocuments()
: Integer.MAX_VALUE;
@@ -86,10 +86,9 @@ public class Runner {
if (commandLineArgs.getVerbose()) {
System.err.println(feedClient.getStatsAsJson());
- double fileSizeMb = ((double) new File(commandLineArgs.getFile()).length()) / 1024.0 / 1024.0;
double transferTimeSec = ((double) sendTotalTimeMs) / 1000.0;
- System.err.println("Sent " + fileSizeMb + " MB in " + transferTimeSec + " seconds.");
- System.err.println("Speed: " + ((fileSizeMb / transferTimeSec) * 8.0) + " Mbits/sec, + HTTP overhead " +
+ System.err.println("Sent " + inputSizeMb + " MB in " + transferTimeSec + " seconds.");
+ System.err.println("Speed: " + ((inputSizeMb / transferTimeSec) * 8.0) + " Mbits/sec, + HTTP overhead " +
"(not taking compression into account)");
if (transferTimeSec > 0) {
System.err.printf("Docs/sec %.3f%n\n", numSent.get() / transferTimeSec);
