lib/src/main/java/edu/utexas/tacc/tapis/files/lib/clients/IrodsDataClient.java
@Override
    public void insert(@NotNull String remotePath, @NotNull InputStream fileStream) throws IOException {
        Path cleanedPath = cleanAndRelativize(remotePath);
        Path fullPath = Paths.get("/", rootDir, cleanedPath.toString());
        Path parentDir = fullPath.getParent();
        IRODSFileFactory fileFactory = getFileFactory();

        try {
            //Make sure parent path exists first
            IRODSFile parent = fileFactory.instanceIRODSFile(parentDir.toString());
            if (!parent.exists()) {
                Path relativePathtoParent = Paths.get(rootDir).relativize(parentDir);
                mkdir(relativePathtoParent.toString());
            }
            parent.close();

            IRODSFile newFile = fileFactory.instanceIRODSFile(fullPath.toString());
            try (
                fileStream;
                IRODSFileOutputStream outputStream = fileFactory.instanceIRODSFileOutputStream(newFile);
            ) {
                fileStream.transferTo(outputStream);
            } catch (JargonException ex) {
                String msg = Utils.getMsg("FILES_IRODS_ERROR", oboTenantId, "", oboTenantId, oboUsername);
                throw new IOException(msg, ex);
            }
            finally {
                newFile.close();
            }
        } catch (JargonException ex) {
            String msg = Utils.getMsg("FILES_IRODS_ERROR", oboTenantId, "", oboTenantId, oboUsername);
            throw new IOException(msg, ex);
        }
    }
/**
     *
     * @param remotePath Always relative to rootDir
     * @param fileStream InputStream to send to irods
     * @throws IOException if auth failed or insert failed
     */
@param remotePath Always relative to rootDir
@param fileStream InputStream to send to irods
@throws IOException if auth failed or insert failed
@param remotePath Always relative to rootDir @param fileStream InputStream to send to irods @throws IOException if auth failed or insert failed
@Override
    public void insert(@NotNull String remotePath, @NotNull InputStream fileStream) throws IOException {
        Path cleanedPath = cleanAndRelativize(remotePath);
        Path fullPath = Paths.get("/", rootDir, cleanedPath.toString());
        Path parentDir = fullPath.getParent();
        IRODSFileFactory fileFactory = getFileFactory();
        try {
            IRODSFile parent = fileFactory.instanceIRODSFile(parentDir.toString());
            if (!parent.exists()) {
                Path relativePathtoParent = Paths.get(rootDir).relativize(parentDir);
                mkdir(relativePathtoParent.toString());
            }
            parent.close();
            IRODSFile newFile = fileFactory.instanceIRODSFile(fullPath.toString());
            try (
                fileStream;
                IRODSFileOutputStream outputStream = fileFactory.instanceIRODSFileOutputStream(newFile);
            ) {
                fileStream.transferTo(outputStream);
            } catch (JargonException ex) {
                String msg = Utils.getMsg("FILES_IRODS_ERROR", oboTenantId, "", oboTenantId, oboUsername);
                throw new IOException(msg, ex);
            }
            finally {
                newFile.close();
            }
        } catch (JargonException ex) {
            String msg = Utils.getMsg("FILES_IRODS_ERROR", oboTenantId, "", oboTenantId, oboUsername);
            throw new IOException(msg, ex);
        }
    }
@ Override public void insert ( @ NotNull String remotePath , @ NotNull InputStream fileStream ) throws IOException { Path cleanedPath = cleanAndRelativize ( remotePath ) ; Path fullPath = Paths . get ( "/" , rootDir , cleanedPath . toString ( ) ) ; Path parentDir = fullPath . getParent ( ) ; IRODSFileFactory fileFactory = getFileFactory ( ) ; try { IRODSFile parent = fileFactory . instanceIRODSFile ( parentDir . toString ( ) ) ; if ( ! parent . exists ( ) ) { Path relativePathtoParent = Paths . get ( rootDir ) . relativize ( parentDir ) ; mkdir ( relativePathtoParent . toString ( ) ) ; } parent . close ( ) ; IRODSFile newFile = fileFactory . instanceIRODSFile ( fullPath . toString ( ) ) ; try ( fileStream ; IRODSFileOutputStream outputStream = fileFactory . instanceIRODSFileOutputStream ( newFile ) ; ) { fileStream . transferTo ( outputStream ) ; } catch ( JargonException ex ) { String msg = Utils . getMsg ( "FILES_IRODS_ERROR" , oboTenantId , "" , oboTenantId , oboUsername ) ; throw new IOException ( msg , ex ) ; } finally { newFile . close ( ) ; } } catch ( JargonException ex ) { String msg = Utils . getMsg ( "FILES_IRODS_ERROR" , oboTenantId , "" , oboTenantId , oboUsername ) ; throw new IOException ( msg , ex ) ; } }
@param remotePath Always relative to rootDir
 @param fileStream InputStream to send to irods
 @throws IOException if auth failed or insert failed
@param remotePath Always relative to rootDir @param fileStream InputStream to send to irods @throws IOException if auth failed or insert failed
//Make sure parent path exists first