From 553a503627b187be689bcafa62c8ac8fa82d5760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 29 Jun 2013 19:39:36 +0200 Subject: [PATCH] Issue #162 Fixed DefineBitsJPEG2 editing (getData) --- .../flash/tags/DefineBitsJPEG2Tag.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java index 17e5f8c25..89b960292 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineBitsJPEG2Tag.java @@ -17,11 +17,14 @@ package com.jpexs.decompiler.flash.tags; import com.jpexs.decompiler.flash.SWFInputStream; +import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.tags.base.AloneTag; import com.jpexs.decompiler.flash.tags.base.ImageTag; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.OutputStream; import java.util.List; import javax.imageio.ImageIO; @@ -60,4 +63,17 @@ public class DefineBitsJPEG2Tag extends ImageTag implements AloneTag { public void setImage(byte data[]) { imageData = data; } + + @Override + public byte[] getData(int version) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStream os = baos; + SWFOutputStream sos = new SWFOutputStream(os, version); + try { + sos.writeUI16(characterID); + sos.write(imageData); + } catch (IOException e) { + } + return baos.toByteArray(); + } }