2019-02-01 06:27:16 +00:00
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// snippet-start:[polly.java.ListLexicons.complete]
package com.amazonaws.polly.samples ;
2024-01-16 10:41:11 -05:00
2019-02-01 06:27:16 +00:00
import com.amazonaws.services.polly.AmazonPolly ;
import com.amazonaws.services.polly.AmazonPollyClientBuilder ;
import com.amazonaws.services.polly.model.LexiconAttributes ;
import com.amazonaws.services.polly.model.LexiconDescription ;
import com.amazonaws.services.polly.model.ListLexiconsRequest ;
import com.amazonaws.services.polly.model.ListLexiconsResult ;
2024-01-16 10:41:11 -05:00
2019-02-01 06:27:16 +00:00
public class ListLexiconsSample {
AmazonPolly client = AmazonPollyClientBuilder . defaultClient ( ) ;
2024-01-16 10:41:11 -05:00
2019-02-01 06:27:16 +00:00
public void listLexicons ( ) {
ListLexiconsRequest listLexiconsRequest = new ListLexiconsRequest ( ) ;
2024-01-16 10:41:11 -05:00
2019-02-01 06:27:16 +00:00
try {
String nextToken ;
do {
ListLexiconsResult listLexiconsResult = client . listLexicons ( listLexiconsRequest ) ;
nextToken = listLexiconsResult . getNextToken ( ) ;
listLexiconsRequest . setNextToken ( nextToken ) ;
2024-01-16 10:41:11 -05:00
2019-02-01 06:27:16 +00:00
for ( LexiconDescription lexiconDescription : listLexiconsResult . getLexicons ( ) ) {
LexiconAttributes attributes = lexiconDescription . getAttributes ( ) ;
System . out . println ( " Name: " + lexiconDescription . getName ( )
+ " , Alphabet: " + attributes . getAlphabet ( )
+ " , LanguageCode: " + attributes . getLanguageCode ( )
+ " , LastModified: " + attributes . getLastModified ( )
+ " , LexemesCount: " + attributes . getLexemesCount ( )
+ " , LexiconArn: " + attributes . getLexiconArn ( )
+ " , Size: " + attributes . getSize ( ) ) ;
}
} while ( nextToken ! = null ) ;
} catch ( Exception e ) {
System . err . println ( " Exception caught: " + e ) ;
}
}
}
// snippet-end:[polly.java.ListLexicons.complete]