Fixed #1908 Slow commandline opening SWF

This commit is contained in:
Jindra Petřík
2022-12-23 17:02:50 +01:00
parent f8488683cd
commit c4befddd5f
3 changed files with 14 additions and 2 deletions
@@ -2267,7 +2267,7 @@ public class CommandLineArgumentParser {
OpenableSourceInfo sourceInfo = new OpenableSourceInfo(null, inFile.getAbsolutePath(), inFile.getName());
SWF swf;
try {
swf = new SWF(new StdInAwareFileInputStream(inFile), sourceInfo.getFile(), sourceInfo.getFileTitle(), Configuration.parallelSpeedUp.get(), charset);
swf = new SWF(new BufferedInputStream(new StdInAwareFileInputStream(inFile)), sourceInfo.getFile(), sourceInfo.getFileTitle(),null, Configuration.parallelSpeedUp.get(), false, true, charset);
} catch (FileNotFoundException | SwfOpenException ex) {
// FileNotFoundException when anti virus software blocks to open the file
logger.log(Level.SEVERE, "Failed to open swf: " + inFile.getName(), ex);
@@ -69,5 +69,15 @@ public class StdInAwareFileInputStream extends InputStream implements AutoClosea
@Override
public void close() throws IOException {
is.close();
}
}
@Override
public int read(byte[] b) throws IOException {
return is.read(b);
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
return is.read(b, off, len);
}
}