Move setByteOrder to DDSImageReader.readHeader

This commit is contained in:
Paul Allen
2024-09-24 11:17:03 +01:00
parent 789cbe88b6
commit edf132b738
2 changed files with 3 additions and 3 deletions

View File

@@ -25,9 +25,7 @@ final class DDSHeader {
public static DDSHeader read(final ImageInputStream imageInput) throws IOException {
DDSHeader header = new DDSHeader();
imageInput.setByteOrder(ByteOrder.LITTLE_ENDIAN);
// Read MAGIC bytes [0,3]
byte[] magic = new byte[DDS.MAGIC.length];
imageInput.readFully(magic);

View File

@@ -10,6 +10,7 @@ import javax.imageio.spi.ImageReaderSpi;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -86,6 +87,7 @@ public final class DDSImageReader extends ImageReaderBase {
private void readHeader() throws IOException {
if (header == null) {
imageInput.setByteOrder(ByteOrder.LITTLE_ENDIAN);
header = DDSHeader.read(imageInput);
imageInput.flushBefore(imageInput.getStreamPosition());