Writes the 8-byte image file header.
(OutputStream out)
| 242 | |
| 243 | /** Writes the 8-byte image file header. */ |
| 244 | void writeHeader(OutputStream out) throws IOException { |
| 245 | byte[] hdr = new byte[8]; |
| 246 | if (littleEndian) { |
| 247 | hdr[0] = 73; // "II" (Intel byte order) |
| 248 | hdr[1] = 73; |
| 249 | hdr[2] = 42; // 42 (magic number) |
| 250 | hdr[3] = 0; |
| 251 | hdr[4] = 8; // 8 (offset to first IFD) |
| 252 | hdr[5] = 0; |
| 253 | hdr[6] = 0; |
| 254 | hdr[7] = 0; |
| 255 | } else { |
| 256 | hdr[0] = 77; // "MM" (Motorola byte order) |
| 257 | hdr[1] = 77; |
| 258 | hdr[2] = 0; // 42 (magic number) |
| 259 | hdr[3] = 42; |
| 260 | hdr[4] = 0; // 8 (offset to first IFD) |
| 261 | hdr[5] = 0; |
| 262 | hdr[6] = 0; |
| 263 | hdr[7] = 8; |
| 264 | } |
| 265 | out.write(hdr); |
| 266 | } |
| 267 | |
| 268 | /** Writes one 12-byte IFD entry. */ |
| 269 | void writeEntry(OutputStream out, int tag, int fieldType, int count, int value) throws IOException { |