@@ -138,13 +138,16 @@ private HttpRequest.Builder CreateHttpRequestBuilderWithHeaders(URI uri, String
138138 }
139139
140140 /**
141- * Asynchronously retrieves a VaasVerdict for the given SHA-256 hash.
142- * This method uses cache and hash lookup options by default.
141+ * Asynchronously retrieves a {@link CompletableFuture} containing the
142+ * {@link VaasVerdict} for the given SHA-256 hash.
143+ * This method uses cache and hash lookup options by default.
143144 *
144145 * @param sha256 the SHA-256 hash to retrieve the verdict for
145- * @return A CompletableFuture that will complete with the VaasVerdict.
146- * @throws IOException If an I/O error occurs during the request.
147- * @throws InterruptedException If the operation is interrupted.
146+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
147+ * the hash
148+ * @throws IOException If an I/O error occurs during the
149+ * request.
150+ * @throws InterruptedException If the operation is interrupted.
148151 * @throws VaasAuthenticationException If there is an authentication error.
149152 */
150153 @ Override
@@ -157,13 +160,17 @@ public CompletableFuture<VaasVerdict> forSha256Async(Sha256 sha256)
157160 }
158161
159162 /**
160- * Asynchronously retrieves a VaasVerdict for the given SHA-256 hash.
163+ * Asynchronously retrieves a {@link CompletableFuture} containing the
164+ * {@link VaasVerdict} for the given SHA-256 hash.
161165 *
162- * @param sha256 the SHA-256 hash to retrieve the verdict for
163- * @param options The options to customize the request, such as cache usage and hash lookup.
164- * @return A CompletableFuture that will complete with the VaasVerdict.
165- * @throws IOException If an I/O error occurs during the request.
166- * @throws InterruptedException If the operation is interrupted.
166+ * @param sha256 the SHA-256 hash to retrieve the verdict for
167+ * @param options The options to customize the request, such as using the cache
168+ * and hash lookup.
169+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
170+ * the hash
171+ * @throws IOException If an I/O error occurs during the
172+ * request.
173+ * @throws InterruptedException If the operation is interrupted.
167174 * @throws VaasAuthenticationException If there is an authentication error.
168175 */
169176 @ Override
@@ -183,13 +190,15 @@ public CompletableFuture<VaasVerdict> forSha256Async(Sha256 sha256, ForSha256Opt
183190 }
184191
185192 /**
186- * Retrieves a VaasVerdict for the given SHA-256 hash.
193+ * Retrieves a {@link VaasVerdict} for the given SHA-256 hash.
194+ * This method uses cache and hash lookup options by default.
187195 *
188196 * @param sha256 the SHA-256 hash to retrieve the verdict for
189- * @return the VaasVerdict for the given SHA-256 hash
190- * @throws InterruptedException if the thread is interrupted while waiting for the result
191- * @throws ExecutionException if the computation threw an exception
192- * @throws IOException if an I/O error occurs
197+ * @return the {@link VaasVerdict} for the given SHA-256 hash
198+ * @throws InterruptedException if the thread is interrupted while
199+ * waiting for the result
200+ * @throws ExecutionException if the computation threw an exception
201+ * @throws IOException if an I/O error occurs
193202 * @throws VaasAuthenticationException if there is an authentication error
194203 */
195204 @ Override
@@ -198,12 +207,41 @@ public VaasVerdict forSha256(Sha256 sha256)
198207 return forSha256Async (sha256 ).get ();
199208 }
200209
210+ /**
211+ * Retrieves a {@link VaasVerdict} for the given SHA-256 hash.
212+ * This method uses cache and hash lookup options by default.
213+ *
214+ * @param sha256 the SHA-256 hash to retrieve the verdict for
215+ * @param options The options to customize the request, such as using the cache
216+ * and hash lookup.
217+ * @return the {@link VaasVerdict} for the given SHA-256 hash
218+ * @throws InterruptedException if the thread is interrupted while
219+ * waiting for the result
220+ * @throws ExecutionException if the computation threw an exception
221+ * @throws IOException if an I/O error occurs
222+ * @throws VaasAuthenticationException if there is an authentication error
223+ */
201224 @ Override
202225 public VaasVerdict forSha256 (Sha256 sha256 , ForSha256Options options )
203226 throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
204227 return forSha256Async (sha256 , options ).get ();
205228 }
206229
230+ /**
231+ * Asynchronously processes a file and returns a {@link CompletableFuture}
232+ * containing the {@link VaasVerdict}.
233+ * This method uses default options for file processing, including using the
234+ * cache and hash lookup.
235+ *
236+ * @param file the {@link Path} to the file to be processed
237+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
238+ * the file
239+ * @throws IOException if an I/O error occurs
240+ * @throws InterruptedException if the operation is interrupted
241+ * @throws VaasAuthenticationException if authentication fails
242+ * @throws NoSuchAlgorithmException if the algorithm for hash lookup is not
243+ * available
244+ */
207245 @ Override
208246 public CompletableFuture <VaasVerdict > forFileAsync (Path file )
209247 throws IOException , InterruptedException , VaasAuthenticationException , NoSuchAlgorithmException {
@@ -213,6 +251,23 @@ public CompletableFuture<VaasVerdict> forFileAsync(Path file)
213251 return forFileAsync (file , forFileOptions );
214252 }
215253
254+ /**
255+ * Asynchronously processes a file and returns a {@link CompletableFuture}
256+ * containing the {@link VaasVerdict}.
257+ * This method uses default options for file processing, including using the
258+ * cache and hash lookup.
259+ *
260+ * @param file the {@link Path} to the file to be processed
261+ * @param options The options to customize the request, such as using the cache
262+ * and hash lookup.
263+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
264+ * the file
265+ * @throws IOException if an I/O error occurs
266+ * @throws InterruptedException if the operation is interrupted
267+ * @throws VaasAuthenticationException if authentication fails
268+ * @throws NoSuchAlgorithmException if the algorithm for hash lookup is not
269+ * available
270+ */
216271 @ Override
217272 public CompletableFuture <VaasVerdict > forFileAsync (Path file , ForFileOptions options )
218273 throws IOException , InterruptedException , VaasAuthenticationException , NoSuchAlgorithmException {
@@ -254,23 +309,79 @@ public CompletableFuture<VaasVerdict> forFileAsync(Path file, ForFileOptions opt
254309 })).orTimeout (this .config .getDefaultTimeoutInMs (), TimeUnit .MILLISECONDS );
255310 }
256311
312+ /**
313+ * Processes a file and returns the {@link VaasVerdict}.
314+ * This method uses default options for file processing, including using the
315+ * cache and hash lookup.
316+ *
317+ * @param file the {@link Path} to the file to be processed
318+ * @return the {@link VaasVerdict} for the file
319+ * @throws IOException if an I/O error occurs
320+ * @throws InterruptedException if the operation is interrupted
321+ * @throws VaasAuthenticationException if authentication fails
322+ * @throws NoSuchAlgorithmException if the algorithm for hash lookup is not
323+ * available
324+ */
257325 @ Override
258- public VaasVerdict forFile (Path file ) throws NoSuchAlgorithmException , InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
326+ public VaasVerdict forFile (Path file ) throws NoSuchAlgorithmException , InterruptedException , ExecutionException ,
327+ IOException , VaasAuthenticationException {
259328 return forFileAsync (file ).get ();
260329 }
261330
331+ /**
332+ * Processes a file and returns the {@link VaasVerdict}.
333+ *
334+ * @param file the {@link Path} to the file to be processed
335+ * @param options The options to customize the request, such as using the cache
336+ * and hash lookup.
337+ * @return the {@link VaasVerdict} for the file
338+ * @throws IOException if an I/O error occurs
339+ * @throws InterruptedException if the operation is interrupted
340+ * @throws VaasAuthenticationException if authentication fails
341+ * @throws NoSuchAlgorithmException if the algorithm for hash lookup is not
342+ * available
343+ */
262344 @ Override
263- public VaasVerdict forFile (Path file , ForFileOptions options ) throws NoSuchAlgorithmException , InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
345+ public VaasVerdict forFile (Path file , ForFileOptions options ) throws NoSuchAlgorithmException , InterruptedException ,
346+ ExecutionException , IOException , VaasAuthenticationException {
264347 return forFileAsync (file , options ).get ();
265348 }
266349
350+ /**
351+ * Asynchronously processes a given input stream and returns a
352+ * {@link CompletableFuture}
353+ * containing the {@link VaasVerdict}.
354+ * This method uses the hash lookup option by default.
355+ *
356+ * @param stream the input stream to be processed
357+ * @param contentLength the length of the content in the input stream
358+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict}
359+ * @throws IOException if an I/O error occurs
360+ * @throws InterruptedException if the operation is interrupted
361+ * @throws VaasAuthenticationException if authentication fails
362+ */
267363 @ Override
268- public CompletableFuture <VaasVerdict > forStreamAsync (InputStream stream , long contentLength ) throws IOException , InterruptedException , VaasAuthenticationException {
364+ public CompletableFuture <VaasVerdict > forStreamAsync (InputStream stream , long contentLength )
365+ throws IOException , InterruptedException , VaasAuthenticationException {
269366 var forStreamOptions = new ForStreamOptions ();
270367 forStreamOptions .setUseHashLookup (true );
271368 return forStreamAsync (stream , contentLength , forStreamOptions );
272369 }
273370
371+ /**
372+ * Asynchronously processes a given input stream and returns a
373+ * {@link CompletableFuture}
374+ * containing the {@link VaasVerdict}.
375+ *
376+ * @param inputStream the input stream to be processed
377+ * @param contentLength the length of the content in the input stream
378+ * @param options The options to customize the request, such as using the
379+ * hash lookup.
380+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict}
381+ * @throws IOException if an I/O error occurs
382+ * @throws InterruptedException if the operation is interrupted
383+ * @throws VaasAuthenticationException if authentication fails
384+ */
274385 @ Override
275386 public CompletableFuture <VaasVerdict > forStreamAsync (InputStream inputStream , long contentLength ,
276387 ForStreamOptions options ) throws IOException , InterruptedException , VaasAuthenticationException {
@@ -301,25 +412,83 @@ public CompletableFuture<VaasVerdict> forStreamAsync(InputStream inputStream, lo
301412 })).orTimeout (this .config .getDefaultTimeoutInMs (), TimeUnit .MILLISECONDS );
302413 }
303414
415+ /**
416+ * Processes a given input stream and returns the {@link VaasVerdict}.
417+ * This method uses the hash lookup option by default.
418+ *
419+ * @param stream the input stream to be processed
420+ * @param contentLength the length of the content in the input stream
421+ * @return the {@link VaasVerdict}
422+ * @throws InterruptedException if the operation is interrupted
423+ * @throws ExecutionException if the computation threw an exception
424+ * @throws IOException if an I/O error occurs
425+ * @throws VaasAuthenticationException if there is an authentication error
426+ */
304427 @ Override
305- public VaasVerdict forStream (InputStream stream , long contentLength ) throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
428+ public VaasVerdict forStream (InputStream stream , long contentLength )
429+ throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
306430 return forStreamAsync (stream , contentLength ).get ();
307431 }
308432
433+ /**
434+ * Processes a given input stream and returns the {@link VaasVerdict}.
435+ *
436+ * @param stream the input stream to be processed
437+ * @param contentLength the length of the content in the input stream
438+ * @param options The options to customize the request, such as using the
439+ * hash lookup.
440+ * @return the {@link VaasVerdict}
441+ * @throws InterruptedException if the operation is interrupted
442+ * @throws ExecutionException if the computation threw an exception
443+ * @throws IOException if an I/O error occurs
444+ * @throws VaasAuthenticationException if there is an authentication error
445+ */
309446 @ Override
310- public VaasVerdict forStream (InputStream stream , long contentLength , ForStreamOptions options ) throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
447+ public VaasVerdict forStream (InputStream stream , long contentLength , ForStreamOptions options )
448+ throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
311449 return forStreamAsync (stream , contentLength , options ).get ();
312450 }
313451
452+ /**
453+ * Asynchronously retrieves a {@link CompletableFuture} containing the
454+ * {@link VaasVerdict} for the given URL.
455+ * This method uses hash lookup by default.
456+ *
457+ * @param url the URL to retrieve the verdict for
458+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
459+ * the
460+ * URL
461+ * @throws IOException If an I/O error occurs during the
462+ * request.
463+ * @throws InterruptedException If the operation is interrupted.
464+ * @throws VaasAuthenticationException If there is an authentication error.
465+ */
314466 @ Override
315- public CompletableFuture <VaasVerdict > forUrlAsync (URL url ) throws IOException , InterruptedException , VaasAuthenticationException {
467+ public CompletableFuture <VaasVerdict > forUrlAsync (URL url )
468+ throws IOException , InterruptedException , VaasAuthenticationException {
316469 var forUrlOptions = new ForUrlOptions ();
317470 forUrlOptions .setUseHashLookup (true );
318471 return forUrlAsync (url , forUrlOptions );
319472 }
320473
474+ /**
475+ * Asynchronously retrieves a {@link CompletableFuture} containing the
476+ * {@link VaasVerdict} for the given URL.
477+ *
478+ * @param url the URL to retrieve the verdict for
479+ * @param options The options to customize the request, such as using hash
480+ * lookup.
481+ * @return a {@link CompletableFuture} containing the {@link VaasVerdict} for
482+ * the
483+ * URL
484+ * @throws IOException If an I/O error occurs during the
485+ * request.
486+ * @throws InterruptedException If the operation is interrupted.
487+ * @throws VaasAuthenticationException If there is an authentication error.
488+ */
321489 @ Override
322- public CompletableFuture <VaasVerdict > forUrlAsync (URL url , ForUrlOptions options ) throws IOException , InterruptedException , VaasAuthenticationException {
490+ public CompletableFuture <VaasVerdict > forUrlAsync (URL url , ForUrlOptions options )
491+ throws IOException , InterruptedException , VaasAuthenticationException {
323492 var params = Map .of ("useHashLookup" , String .valueOf (options .isUseHashLookup ()));
324493 var urlsUri = this .config .getUrl () + "/urls" ;
325494 var urlAnalysisRequest = new UrlAnalysisRequest (url .toString (), options .isUseHashLookup ());
@@ -350,13 +519,42 @@ public CompletableFuture<VaasVerdict> forUrlAsync(URL url, ForUrlOptions options
350519 .orTimeout (this .config .getDefaultTimeoutInMs (), TimeUnit .MILLISECONDS );
351520 }
352521
522+ /**
523+ * Retrieves a {@link VaasVerdict} for the given URL.
524+ * This method uses hash lookup by default.
525+ *
526+ * @param url the URL to retrieve the verdict for
527+ * @return the {@link VaasVerdict} for the URL
528+ * @throws InterruptedException if the thread is interrupted while
529+ * waiting
530+ * for the result
531+ * @throws ExecutionException if the computation threw an exception
532+ * @throws IOException if an I/O error occurs
533+ * @throws VaasAuthenticationException if there is an authentication error
534+ */
353535 @ Override
354- public VaasVerdict forUrl (URL url ) throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
536+ public VaasVerdict forUrl (URL url )
537+ throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
355538 return forUrlAsync (url ).get ();
356539 }
357540
541+ /**
542+ * Retrieves a {@link VaasVerdict} for the given URL.
543+ *
544+ * @param url the URL to retrieve the verdict for
545+ * @param options The options to customize the request, such as using hash
546+ * lookup.
547+ * @return the {@link VaasVerdict} for the URL
548+ * @throws InterruptedException if the thread is interrupted while
549+ * waiting
550+ * for the result
551+ * @throws ExecutionException if the computation threw an exception
552+ * @throws IOException if an I/O error occurs
553+ * @throws VaasAuthenticationException if there is an authentication error
554+ */
358555 @ Override
359- public VaasVerdict forUrl (URL url , ForUrlOptions options ) throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
556+ public VaasVerdict forUrl (URL url , ForUrlOptions options )
557+ throws InterruptedException , ExecutionException , IOException , VaasAuthenticationException {
360558 return forUrlAsync (url , options ).get ();
361559 }
362560}
0 commit comments