code: public InputStream retrieveAttachment(SignalServiceAttachmentPointer pointer, File destination, int maxSizeBytes, ProgressListener listener)
        throws IOException, InvalidMessageException
    {
      if (!pointer.getDigest().isPresent()) throw new InvalidMessageException("No attachment digest!");
  
      socket.retrieveAttachment(pointer.getId(), destination, maxSizeBytes, listener);
      return AttachmentCipherInputStream.createFor(destination, pointer.getSize().or(0), pointer.getKey(), pointer.getDigest().get());
    }
docs: Retrieves a SignalServiceAttachment.
  
  @param pointer The {@link SignalServiceAttachmentPointer}
  received in a {@link SignalServiceDataMessage}.
  @param destination The download destination for this attachment.
  @param listener An optional listener (may be null) to receive callbacks on download progress.
  
  @return An InputStream that streams the plaintext attachment contents.
  @throws IOException
  @throws InvalidMessageException