Source:
<code>public static void main(String[] args) throws IOException { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Invoice_6.pdf"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); PollerFlux<OperationResult, List<RecognizedForm>> recognizeFormPoller; try (InputStream targetStream = new ByteArrayInputStream(fileContent)) { <START> String modelId = "{modelId}"; <END> recognizeFormPoller = client.beginRecognizeCustomForms(toFluxByteBuffer(targetStream), sourceFile.length(), modelId); } Mono<List<RecognizedForm>> recognizeFormResult = recognizeFormPoller .last() .flatMap(pollResponse -> { if (pollResponse.getStatus().isComplete()) { return pollResponse.getFinalResult(); } else { return Mono.error(new RuntimeException("Polling completed unsuccessfully with status:" + pollResponse.getStatus())); } }); recognizeFormResult.subscribe(recognizedForms -> { for (int i = 0; i < recognizedForms.size(); i++) { final RecognizedForm form = recognizedForms.get(i); System.out.printf("----------- Recognized Form page %d -----------%n", i); System.out.printf("Form type: %s%n", form.getFormType()); form.getFields().forEach((label, formField) -> { System.out.printf("Field %s has value %s with confidence score of %.2f.%n", label, formField.getValueData().getText(), formField.getConfidence()); }); System.out.print("-----------------------------------"); } }); try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>is purpose of try() catch()</technical_language>

Target:
public static void main(String[] args) throws IOException { FormRecognizerAsyncClient client = new FormRecognizerClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("https://{endpoint}.cognitiveservices.azure.com/") .buildAsyncClient(); File sourceFile = new File("../formrecognizer/azure-ai-formrecognizer/src/samples/java/sample-forms/" + "forms/Invoice_6.pdf"); byte[] fileContent = Files.readAllBytes(sourceFile.toPath()); String modelId = "{modelId}"; PollerFlux<OperationResult, List<RecognizedForm>> recognizeFormPoller; try (InputStream targetStream = new ByteArrayInputStream(fileContent)) { recognizeFormPoller = client.beginRecognizeCustomForms(toFluxByteBuffer(targetStream), sourceFile.length(), modelId); } Mono<List<RecognizedForm>> recognizeFormResult = recognizeFormPoller .last() .flatMap(pollResponse -> { if (pollResponse.getStatus().isComplete()) { return pollResponse.getFinalResult(); } else { return Mono.error(new RuntimeException("Polling completed unsuccessfully with status:" + pollResponse.getStatus())); } }); recognizeFormResult.subscribe(recognizedForms -> { for (int i = 0; i < recognizedForms.size(); i++) { final RecognizedForm form = recognizedForms.get(i); System.out.printf("----------- Recognized custom form info for page %d -----------%n", i); System.out.printf("Form type: %s%n", form.getFormType()); form.getFields().forEach((label, formField) -> { System.out.printf("Field '%s' has label '%s' with confidence score of %.2f.%n", label, formField.getLabelData().getText(), formField.getConfidence()); }); } }); try { TimeUnit.MINUTES.sleep(1); } catch (InterruptedException e) { e.printStackTrace(); } }