private IFDEntry readIFDEntry(FileChannel channel, int start) throws IOException {
if (debugRead) System.out.println("readIFDEntry starting position to " + start);
channel.position(start);
ByteBuffer buffer = ByteBuffer.allocate(12);
buffer.order(byteOrder);
channel.read(buffer);
buffer.flip();
if (showBytes) printBytes(System.out, "IFDEntry bytes", buffer, 12);
IFDEntry ifd;
buffer.position(0);
int code = readUShortValue(buffer);
Tag tag = Tag.get(code);
if (tag == null) tag = new Tag(code);
FieldType type = FieldType.get(readUShortValue(buffer));
int count = buffer.getInt();
ifd = new IFDEntry(tag, type, count);
if (ifd.count * ifd.type.size <= 4) {
readValues(buffer, ifd);
} else {
int offset = buffer.getInt();
if (debugRead) System.out.println("position to " + offset);
channel.position(offset);
ByteBuffer vbuffer = ByteBuffer.allocate(ifd.count * ifd.type.size);
vbuffer.order(byteOrder);
channel.read(vbuffer);
vbuffer.flip();
readValues(vbuffer, ifd);
}
return ifd;
}