private void verifyExists() throws FileNotFoundException { if (!exists()) { throw new FileNotFoundException(String.format("%s does not exist.", getDescription())); } } }
/** * Retrieve the download stream. * * @return */ public Flux<DataBuffer> getDownloadStream() { if (!exists()) { return Flux.error(new FileNotFoundException(String.format("%s does not exist.", getDescription()))); } return content; }
/** * Returns the {@link Resource}'s id. * * @return never {@literal null}. * @throws IllegalStateException if the file does not {@link #exists()}. */ public Object getId() { Assert.state(exists(), () -> String.format("%s does not exist.", getDescription())); return file.getId(); }