public static Attachment createAttachment(String path, InputStream content, long contentLength, boolean isBinary) throws IOException {
    if (contentLength >= BIG_FILE_THRESHOLD_BYTES) {
      Path tempFile = FileUtil.createTempFile("ij-attachment-" + PathUtilRt.getFileName(path) + '.', isBinary ? ".bin" : ".txt", true).toPath();
      Files.copy(content, tempFile, StandardCopyOption.REPLACE_EXISTING);
      return new Attachment(path, tempFile, "[File is too big to display]");
    }
    else {
      byte[] bytes = StreamUtil.readBytes(content);
      String displayText = isBinary ? "[File is binary]" : new String(bytes, StandardCharsets.UTF_8);
      return new Attachment(path, bytes, displayText);
    }
  }
public static Attachment createAttachment(String path, InputStream content, long contentLength, boolean isBinary)