From ce910766938debd10d148935faa9dd4301ebb2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 18 Jul 2016 09:11:09 +0200 Subject: [PATCH] Amf3InputStream uses EndOfStreamException as SWF --- .../decompiler/flash/amf/amf3/Amf3InputStream.java | 7 ++++--- .../amf/amf3/PrematureEndOfTheStreamException.java | 11 ----------- 2 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/PrematureEndOfTheStreamException.java diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/Amf3InputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/Amf3InputStream.java index 2134f9584..7165cb14e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/Amf3InputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/Amf3InputStream.java @@ -1,5 +1,6 @@ package com.jpexs.decompiler.flash.amf.amf3; +import com.jpexs.decompiler.flash.EndOfStreamException; import com.jpexs.decompiler.flash.amf.amf3.types.ArrayType; import com.jpexs.decompiler.flash.amf.amf3.types.XmlType; import com.jpexs.decompiler.flash.amf.amf3.types.ObjectType; @@ -187,7 +188,7 @@ public class Amf3InputStream extends InputStream { byte buf[] = new byte[(int) byteLength]; //how about long strings(?), will the int length be enough? int cnt = is.read(buf); if (cnt < buf.length) { - throw new PrematureEndOfTheStreamException(); + throw new EndOfStreamException(); } String retString = new String(buf, "UTF-8"); endDumpLevel(retString); @@ -220,7 +221,7 @@ public class Amf3InputStream extends InputStream { private int readInternal() throws IOException { int ret = read(); if (ret == -1) { - throw new PrematureEndOfTheStreamException(); + throw new EndOfStreamException(); } return ret; } @@ -510,7 +511,7 @@ public class Amf3InputStream extends InputStream { int byteArrayLength = (int) (byteArrayU29 >> 1); byte byteArrayBuf[] = new byte[byteArrayLength]; if (is.read(byteArrayBuf) != byteArrayLength) { - throw new PrematureEndOfTheStreamException(); + throw new EndOfStreamException(); } LOGGER.log(Level.FINER, "ByteArray value: bytes[{0}]", byteArrayLength); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/PrematureEndOfTheStreamException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/PrematureEndOfTheStreamException.java deleted file mode 100644 index 8c85fa2df..000000000 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/amf/amf3/PrematureEndOfTheStreamException.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.jpexs.decompiler.flash.amf.amf3; - -import java.io.IOException; - -public class PrematureEndOfTheStreamException extends IOException { - - public PrematureEndOfTheStreamException() { - super("Premature end of the stream reached"); - } - -}