private File cacheContent(InputStream inStream)
        throws TaskExecutionFailedException {
        File localFile = null;
        try {
            localFile = File.createTempFile("content-item", ".tmp", workDir);
            try (OutputStream outStream = FileUtils.openOutputStream(localFile)) {
                IOUtils.copy(inStream, outStream);
            }
            inStream.close();
        } catch (IOException e) {

            if (localFile != null) {
                cleanup(localFile);
            }

            String msg = "Unable to cache content file due to: " + e.getMessage();
            throw new DuplicationTaskExecutionFailedException(buildFailureMessage(msg), e);
        }
        return localFile;
    }
private File cacheContent ( InputStream inStream ) throws TaskExecutionFailedException { File localFile = null ; try { localFile = File . createTempFile ( "content-item" , ".tmp" , workDir ) ; try ( OutputStream outStream = FileUtils . openOutputStream ( localFile ) ) { IOUtils . copy ( inStream , outStream ) ; } inStream . close ( ) ; } catch ( IOException e ) { if ( localFile != null ) { cleanup ( localFile ) ; } String msg = "Unable to cache content file due to: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } return localFile ; }
/*
Stores a stream as a file on the local file system