public File asFile ( String fileName ) throws HelloSignException { Integer lastResponseCode = getLastResponseCode ( ) ; File f = null ; try { if ( lastResponseCode != null && lastResponseCode != HttpURLConnection . HTTP_OK ) { this . asJson ( ) ; // Will validate response } f = createTemporaryFile ( fileName ) ; if ( getLastResponseAsFile ( f ) == 0 ) { logger . warn ( "No bytes written to file: " + fileName ) ; } } catch ( HelloSignException ex ) { throw ex ; } finally { reset ( ) ; } return f ; }
Executes the request and returns the response as a File .