mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 11:00:48 +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:
@@ -19,9 +19,11 @@ package com.jpexs.decompiler.flash.helpers;
|
||||
import java.awt.Component;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.PixelGrabber;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* Adapted from
|
||||
@@ -77,7 +79,7 @@ public class BMPFile extends Component {
|
||||
private int[] bitmap;
|
||||
|
||||
//--- File section
|
||||
private FileOutputStream fo;
|
||||
private OutputStream fo;
|
||||
|
||||
//--- Private constructor
|
||||
private BMPFile() {
|
||||
@@ -85,7 +87,7 @@ public class BMPFile extends Component {
|
||||
|
||||
public static void saveBitmap(Image image, File file) throws IOException {
|
||||
BMPFile b = new BMPFile();
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
b.fo = fos;
|
||||
b.save(image, image.getWidth(null), image.getHeight(null));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash.helpers;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType;
|
||||
import com.jpexs.helpers.utf8.Utf8OutputStreamWriter;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
@@ -43,7 +43,7 @@ public class FileTextWriter extends GraphTextWriter implements AutoCloseable {
|
||||
|
||||
public FileTextWriter(CodeFormatting formatting, FileOutputStream fos) {
|
||||
super(formatting);
|
||||
this.writer = new BufferedWriter(new Utf8OutputStreamWriter(fos));
|
||||
this.writer = new Utf8OutputStreamWriter(new BufferedOutputStream(fos));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user