mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 18:00:58 +00:00
always use buffered output streams when writing to a file, faster swf xml export by caching the fields
This commit is contained in:
@@ -1210,7 +1210,7 @@ public class CommandLineArgumentParser {
|
||||
String xml = Helper.readTextFile(args.pop());
|
||||
SWF swf = new SWF();
|
||||
new SwfXmlImporter().importSwf(swf, xml);
|
||||
try (FileOutputStream fos = new FileOutputStream(new File(args.pop()))) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(new File(args.pop())))) {
|
||||
swf.saveTo(new BufferedOutputStream(fos));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
@@ -1400,7 +1400,7 @@ public class CommandLineArgumentParser {
|
||||
DefineSpriteTag ds = (DefineSpriteTag) t;
|
||||
if ("page1".equals(ds.getExportName())) {
|
||||
page = 1;
|
||||
job = new PDFJob(new FileOutputStream(outFile));
|
||||
job = new PDFJob(new BufferedOutputStream(new FileOutputStream(outFile)));
|
||||
} else {
|
||||
if (page > 0) {
|
||||
page++;
|
||||
@@ -1550,7 +1550,7 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
|
||||
try {
|
||||
try (FileOutputStream fos = new FileOutputStream(outFile)) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile))) {
|
||||
swf.saveTo(fos);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import com.jpexs.helpers.utf8.Utf8PrintWriter;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -25,6 +26,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -137,7 +139,7 @@ public class LicenseUpdater {
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(f)) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(f))) {
|
||||
fos.write(baos.toByteArray());
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -64,6 +65,7 @@ import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
@@ -386,7 +388,7 @@ public class Main {
|
||||
}
|
||||
File outfileF = new File(outfile);
|
||||
File tmpFile = new File(outfile + ".tmp");
|
||||
try (FileOutputStream fos = new FileOutputStream(tmpFile)) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tmpFile))) {
|
||||
if (mode == SaveFileMode.EXE) {
|
||||
InputStream exeStream = View.class.getClassLoader().getResourceAsStream("com/jpexs/helpers/resource/Swf2Exe.bin");
|
||||
byte[] buffer = new byte[4096];
|
||||
|
||||
@@ -1126,8 +1126,8 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
}
|
||||
try {
|
||||
tempFile = File.createTempFile("ffdec_view_", ".swf");
|
||||
try (FileOutputStream fos = new FileOutputStream(tempFile)) {
|
||||
swf.saveTo(new BufferedOutputStream(fos));
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tempFile))) {
|
||||
swf.saveTo(fos);
|
||||
}
|
||||
flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, swf.frameRate);
|
||||
} catch (IOException iex) {
|
||||
|
||||
@@ -37,9 +37,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -210,7 +212,7 @@ public class DumpTree extends JTree implements ActionListener {
|
||||
View.setWindowIcon(f);
|
||||
if (fc.showSaveDialog(f) == JFileChooser.APPROVE_OPTION) {
|
||||
File sf = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try (FileOutputStream fos = new FileOutputStream(sf)) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(sf))) {
|
||||
byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData;
|
||||
fos.write(data, (int) dumpInfo.startByte, (int) (dumpInfo.getEndByte() - dumpInfo.startByte + 1));
|
||||
} catch (IOException ex) {
|
||||
|
||||
@@ -55,6 +55,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
@@ -720,7 +721,7 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
|
||||
String tempFilePath = Main.tempFile(url);
|
||||
data.reset();
|
||||
byte[] dataArray = Helper.readStream(data);
|
||||
try (FileOutputStream fos = new FileOutputStream(new File(tempFilePath))) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(new File(tempFilePath)))) {
|
||||
fos.write(dataArray);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user