public void read(Reader reader, long offset, int count, int tag, Type type)
    throws IOException
  {
    ImageInputStream is = reader.getInputStream();

    if (!hasSubFields()) {
      ReaderHandler.ValueAction action = reader.atValue(tag, getName(), count);

      if ((action != null) && (action != ReaderHandler.ValueAction.SKIP)) {
        is.seek(offset);

        if (action == ReaderHandler.ValueAction.RAW) {
          reader.handleRawValue(tag, getName(), count, is);
        } else {
          Object value = processValue(type.read(is, count));
          reader.handleValue(tag, getName(), count, value);
        }
      }

    } else {
      if (count != 1) {
        throw new IOException("Count must be 1 for fields with sub-fields");
      }

      if (reader.startFolder(tag, getName())) {
        int value = ((Integer) type.read(is));
        int index = 0;

        for (Field subField : subFields) {
          int numBits = subField.getType().getLength() * 8;
          subField.handleValue(reader, index, value >> (32 - numBits));

          value = value << numBits;
          index++;
        }

        reader.endFolder();
      }
    }
  }