@@ -0,0 +1,2665 @@
+// snippet-sourcedescription:%5BListLexicons demonstrates how to produce a list of pronunciation lexicons stored in an AWS Region.%5D%0A// snippet-service:%5BAmazon Polly%5D%0A// snippet-keyword:%5BJava%5D%0A// snippet-sourcesyntax:%5Bjava%5D%0A// snippet-keyword:%5BAmazon Polly%5D%0A// snippet-keyword:%5BCode Sample%5D%0A// snippet-keyword:%5BGetLexicon%5D%0A// snippet-sourcetype:%5Bfull-example%5D%0A// snippet-sourcedate:%5B5/7/2020%5D%0A// snippet-sourceauthor:%5Bscmacdon AWS%5D%0A%0A/**%0A * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A *%0A * This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A * You may not use this file except in compliance with the License. A copy of%0A * the License is located at%0A *%0A * http://aws.amazon.com/apache2.0/%0A *%0A * This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A * CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A * specific language governing permissions and limitations under the License.%0A */%0A%0Apackage com.example.polly;%0A%0A// snippet-start:%5Bpolly.java2.list_icons.import%5D%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.polly.PollyClient;%0Aimport software.amazon.awssdk.services.polly.model.ListLexiconsResponse;%0Aimport software.amazon.awssdk.services.polly.model.ListLexiconsRequest;%0Aimport software.amazon.awssdk.services.polly.model.LexiconDescription;%0Aimport software.amazon.awssdk.services.polly.model.PollyException ;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A// snippet-end:%5Bpolly.java2.list_icons.import%5D%0A%0Apublic class ListLexicons %7B%0A%0A    public static void main(String args%5B%5D) %7B%0A%0A        PollyClient polly = PollyClient.builder()%0A                .region(Region.US_WEST_2)%0A                .build();%0A%0A        listLexicons(polly) ;%0A    %7D%0A%0A    // snippet-start:%5Bpolly.java2.list_icons.main%5D%0A    public static void listLexicons(PollyClient client) %7B%0A%0A        try %7B%0A        ListLexiconsRequest listLexiconsRequest = ListLexiconsRequest.builder()%0A                .build();%0A%0A        ListLexiconsResponse listLexiconsResult = client.listLexicons(listLexiconsRequest);%0A        List%3CLexiconDescription%3E lexiconDescription = listLexiconsResult.lexicons();%0A        Iterator%3CLexiconDescription%3E iterator = lexiconDescription.iterator();%0A%0A        // Get each voice%0A        while (iterator.hasNext()) %7B%0A            LexiconDescription lexDescription = iterator.next();%0A            System.out.println(%22The name of the Lexicon is %22 +lexDescription.name());%0A        %7D%0A%0A        %7D catch (PollyException e) %7B%0A            System.err.println(%22Exception caught: %22 + e);%0A            System.exit(1);%0A        %7D%0A    %7D%0A    // snippet-end:%5Bpolly.java2.list_icons.main%5D%0A%7D%0A

Create ListLexicons.java