code: public CompletionStage<String> detectMimeTypeAsync(final Path path) {
  		String filename = path.getFileName().toString();
  
  		Supplier<CompletionStage<byte[]>> supplier = () -> {
  		    final CompletableFuture<byte[]> futureBytes = new CompletableFuture<byte[]>();
  
              AsynchronousFileChannel channel;
              try {
                  channel = AsynchronousFileChannel.open(path, StandardOpenOption.READ);
              } catch (IOException e) {
                  futureBytes.completeExceptionally(new GetBytesException(e));
                  return futureBytes;
              }
  
              final ByteBuffer buf = ByteBuffer.allocate(getMaxGetBytesLength());
              channel.read(buf, 0, futureBytes, new CompletionHandler<Integer, CompletableFuture<byte[]>>() {
                  @Override public void completed(Integer nBytes, CompletableFuture<byte[]> f) {
                      if (nBytes == -1) nBytes = 0; // handle empty file
  
                      byte[] bytes = new byte[nBytes];
                      buf.rewind();
                      buf.get(bytes, 0, nBytes);
                      f.complete(bytes);
                  }
  
                  @Override public void failed(Throwable exc, CompletableFuture<byte[]> f) {
                      f.completeExceptionally(new GetBytesException(exc));
                  }
              });
              return futureBytes;
          };
  		
  		return detectMimeTypeAsync(filename, supplier);
  	}
docs: Determines the MIME type of a file.
  
  <p>
  The file must exist and be readable.
  </p>
  
  <p>
  The CompletionStage may return a {@link ExecutionException} which is caused
  by a {@link GetBytesException}. (That, in turn, will wrap a
  {@link IOException} or other exception that prevented getBytesAsync() from
  working.
  </p>
  
  @param path A file that exists and is readable
  @return a MIME type such as {@literal "text/plain"}
  @see #detectMimeType(String, Callable)