Added InvalidFormat

Added deprecated constructor for InvalidFormat with a null ByteInput for temp back compat
This commit is contained in:
Collin Smith 2020-08-12 15:05:10 -07:00
parent 088cde3b9e
commit d70668d11d
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,28 @@
package com.riiablo.io;
public class InvalidFormat extends RuntimeException {
public final long offset;
public InvalidFormat(ByteInput in, String message) {
this(in, message, null);
}
public InvalidFormat(ByteInput in, Throwable cause) {
this(in, "Invalid format", cause);
}
public InvalidFormat(ByteInput in, String message, Throwable cause) {
super(message + " @0x" + Integer.toHexString(in.bytesRead()), cause);
this.offset = in.bytesRead();
}
@Deprecated
public InvalidFormat(String message) {
super(message, null);
this.offset = 0L;
}
public long offset() {
return offset;
}
}

View File

@ -8,9 +8,9 @@ import com.badlogic.gdx.utils.Array;
import com.riiablo.Riiablo;
import com.riiablo.codec.excel.Gems;
import com.riiablo.codec.util.BitStream;
import com.riiablo.io.InvalidFormat;
import com.riiablo.log.Log;
import com.riiablo.log.LogManager;
import com.riiablo.save.InvalidFormat;
import com.riiablo.util.DebugUtils;
public class ItemSerializer {