Convert 4byte array into %08x string format.

This commit is contained in:
Paul Allen
2024-09-24 10:58:25 +01:00
parent bcfab45977
commit a648d1a327

View File

@@ -3,6 +3,7 @@ package com.twelvemonkeys.imageio.plugins.dds;
import javax.imageio.IIOException;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.ByteOrder;
import java.util.Arrays;
@@ -31,7 +32,7 @@ public final class DDSHeader {
byte[] magic = new byte[DDS.MAGIC.length];
imageInput.readFully(magic);
if (!Arrays.equals(DDS.MAGIC, magic)) {
throw new IIOException(String.format("Not a DDS file. Expected DDS magic %02x, read %02x", Arrays.toString(DDS.MAGIC), magic));
throw new IIOException(String.format("Not a DDS file. Expected DDS magic %s, read %s", String.format("%08x", new BigInteger(1, DDS.MAGIC)), String.format("%08x", new BigInteger(1, magic))));
}
// DDS_HEADER structure