private int readIFD(FileChannel channel, int start) throws IOException { channel.position(start); ByteBuffer buffer = ByteBuffer.allocate(2); buffer.order(byteOrder); int n = channel.read(buffer); assert n == 2; buffer.flip(); if (showBytes) { printBytes(System.out, "IFD", buffer, 2); buffer.rewind(); } short nentries = buffer.getShort(); if (debugRead) System.out.println(" nentries = " + nentries); start += 2; for (int i = 0; i < nentries; i++) { IFDEntry ifd = readIFDEntry(channel, start); if (debugRead) System.out.println(i + " == " + ifd); tags.add(ifd); start += 12; } if (debugRead) System.out.println(" looking for nextIFD at pos == " + channel.position() + " start = " + start); channel.position(start); buffer = ByteBuffer.allocate(4); buffer.order(byteOrder); assert 4 == channel.read(buffer); buffer.flip(); int nextIFD = buffer.getInt(); if (debugRead) System.out.println(" nextIFD == " + nextIFD); return nextIFD; }
private int readIFD(FileChannel channel, int start) throws IOException { channel.position(start); ByteBuffer buffer = ByteBuffer.allocate(2); buffer.order(byteOrder); int n = channel.read(buffer); assert n == 2; buffer.flip(); if (showBytes) { printBytes(System.out, "IFD", buffer, 2); buffer.rewind(); } short nentries = buffer.getShort(); if (debugRead) System.out.println(" nentries = " + nentries); start += 2; for (int i = 0; i < nentries; i++) { IFDEntry ifd = readIFDEntry(channel, start); if (debugRead) System.out.println(i + " == " + ifd); tags.add(ifd); start += 12; } if (debugRead) System.out.println(" looking for nextIFD at pos == " + channel.position() + " start = " + start); channel.position(start); buffer = ByteBuffer.allocate(4); buffer.order(byteOrder); assert 4 == channel.read(buffer); buffer.flip(); int nextIFD = buffer.getInt(); if (debugRead) System.out.println(" nextIFD == " + nextIFD); return nextIFD; }
private int readIFD(FileChannel channel, int start) throws IOException { channel.position(start); ByteBuffer buffer = ByteBuffer.allocate(2); buffer.order(byteOrder); int n = channel.read(buffer); buffer.flip(); if (showBytes) { printBytes(System.out, "IFD", buffer, 2); buffer.rewind(); } short nentries = buffer.getShort(); if (debugRead) System.out.println(" nentries = " + nentries); start += 2; for (int i = 0; i < nentries; i++) { IFDEntry ifd = readIFDEntry(channel, start); if (debugRead) System.out.println(i + " == " + ifd); tags.add(ifd); start += 12; } if (debugRead) System.out.println(" looking for nextIFD at pos == " + channel.position() + " start = " + start); channel.position(start); buffer = ByteBuffer.allocate(4); buffer.order(byteOrder); n = channel.read(buffer); buffer.flip(); int nextIFD = buffer.getInt(); if (debugRead) System.out.println(" nextIFD == " + nextIFD); return nextIFD; }