docs: private static void processPrintIM(@NotNull final PrintIMDirectory directory, final int tagValueOffset, @NotNull final RandomAccessReader reader, final int byteCount) throws IOException
      {
          Boolean resetByteOrder = null;
  
          if (byteCount == 0) {
              directory.addError("Empty PrintIM data");
              return;
          }
  
          if (byteCount <= 15) {
              directory.addError("Bad PrintIM data");
              return;
          }
  
          String header = reader.getString(tagValueOffset, 12, Charsets.UTF_8);
  
          if (!header.startsWith("PrintIM")) {
              directory.addError("Invalid PrintIM header");
              return;
          }
  
          // check size of PrintIM block
          int num = reader.getUInt16(tagValueOffset + 14);
  
          if (byteCount < 16 + num * 6) {
              // size is too big, maybe byte ordering is wrong
              resetByteOrder = reader.isMotorolaByteOrder();
              reader.setMotorolaByteOrder(!reader.isMotorolaByteOrder());
              num = reader.getUInt16(tagValueOffset + 14);
              if (byteCount < 16 + num * 6) {
                  directory.addError("Bad PrintIM size");
                  return;
              }
          }
  
          directory.setObject(PrintIMDirectory.TagPrintImVersion, header.substring(8, 12));
  
          for (int n = 0; n < num; n++) {
              int pos = tagValueOffset + 16 + n * 6;
              int tag = reader.getUInt16(pos);
              long val = reader.getUInt32(pos + 2);
  
              directory.setObject(tag, val);
          }
  
          if (resetByteOrder != null)
              reader.setMotorolaByteOrder(resetByteOrder);
      }