private void imageApiUsage ( ) throws ApiException , IOException { LOG . info ( "The Image API usage." ) ; Images api = retinaApisInstance . imageApi ( ) ; LOG . info ( "Image API: getImageForExpression" ) ; try ( ByteArrayInputStream inputStream = api . getImage ( TEXT_1 ) ) { //get image's stream; if ( inputStream . read ( ) == 0 ) { throw new IllegalStateException ( "A image stream cannot be received." ) ; } } LOG . info ( "Image API: getOverlayImage" ) ; try ( ByteArrayInputStream inputStream = api . compare ( TEXT_1 , TEXT_2 ) ) { //get image's stream; if ( inputStream . read ( ) == 0 ) { throw new IllegalStateException ( "A image stream cannot be received." ) ; } } LOG . info ( "Image API: getImageForBulkExpressions" ) ; List < Image > images = api . getImageBulk ( TEXT_1 , TERM_1 ) ; for ( Image image : images ) { LOG . info ( "Image: imageData size: " + image . getImageData ( ) . length ) ; } }
The Image API usage .