code: public PreparedAttachment prepareAttachment(Attachment att, long length, long encodedLength)
              throws AttachmentException {
          PreparedAttachment pa = AttachmentManager.prepareAttachment(attachmentsDir,
                  attachmentStreamFactory, att, length, encodedLength);
          return pa;
      }
docs: <p>
  Read attachment stream to a temporary location and calculate sha1,
  prior to being added to the DocumentStore.
  </p>
  <p>
  Used by replicator when receiving new/updated attachments
  </p>
  
  @param att           Attachment to be prepared, providing data either from a file or a stream
  @param length        Size in bytes of attachment as signalled by "length" metadata property
  @param encodedLength Size in bytes of attachment, after encoding, as signalled by
  "encoded_length" metadata property
  @return A prepared attachment, ready to be added to the DocumentStore
  @throws AttachmentException if there was an error preparing the attachment, e.g., reading
  attachment data.