docs: public static MultipartAttachmentWriter createMultipartWriter(Map<String,Object> revision,
                                                                    Map<String, ? extends Attachment> attachments,
                                                                    boolean shouldInline,
                                                                    int minRevPos) {
          MultipartAttachmentWriter mpw = null;
          if (!shouldInline) {
              // only build multipart if we're not sending attachments inline
  
              // first sort by attachment name - this means that the
              // entries in the _attachments dictionary are in the same
              // order as the multiparts
              attachments = new TreeMap<String, Attachment>(attachments);
              for (Map.Entry<String, ? extends Attachment> att : attachments.entrySet()) {
                  // we need to cast down to SavedAttachment, which we know is what the AttachmentManager gives us
  
                  SavedAttachment savedAtt = (SavedAttachment) att.getValue();
                  try {
                      // add the attachment if it's newer than the minimum revpos and it's not being sent inline
                      if (savedAtt.revpos > minRevPos) {
                          // add
                          if (mpw == null) {
                              // 1st time init
                              mpw = new MultipartAttachmentWriter();
                              mpw.setBody(revision);
                          }
                          mpw.addAttachment(savedAtt, savedAtt.onDiskLength());
                      }
                  } catch (IOException ioe) {
                      logger.log(Level.WARNING, "IOException caught when adding multiparts", ioe);
                  }
              }
          }
          return mpw;
      }