My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 1 attachment: SpiOrderFix.diff (956 bytes)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Index: src/main/java/net/nikr/dds/DDSImageReaderSpi.java
===================================================================
--- src/main/java/net/nikr/dds/DDSImageReaderSpi.java (revision 16)
+++ src/main/java/net/nikr/dds/DDSImageReaderSpi.java (working copy)
@@ -68,13 +68,18 @@
ImageInputStream stream = (ImageInputStream) source;
stream.reset();
stream.mark();
- stream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- int magic = stream.readInt();
- if (magic != MAGIC) return false;
- int size = stream.readInt();
- if (size != 124) return false;
- stream.reset();
- return true;
+ final ByteOrder order = stream.getByteOrder();
+ try {
+ stream.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ int magic = stream.readInt();
+ if (magic != MAGIC) return false;
+ int size = stream.readInt();
+ if (size != 124) return false;
+ stream.reset();
+ return true;
+ } finally {
+ stream.setByteOrder(order);
+ }
}

@Override
Powered by Google Project Hosting