Example usage for java.io DataInputStream read

List of usage examples for java.io DataInputStream read

Introduction

In this page you can find the example usage for java.io DataInputStream read.

Prototype

public final int read(byte b[]) throws IOException 

Source Link

Document

Reads some number of bytes from the contained input stream and stores them into the buffer array b.

Usage

From source file:hu.sztaki.lpds.pgportal.portlets.file.LFCFileStoragePortlet.java

@Override
public void serveResource(ResourceRequest request, ResourceResponse response)
        throws PortletException, IOException {
    //  PortletSession ps=request.getPortletSession();

    //Download Process

    String filelist = "";
    if (request.getParameter("selected_file") != null
            && !request.getParameter("selected_file").equals(new String(""))) {
        filelist = request.getParameter("selected_file");
    }//from   ww  w .j  a  va  2 s . c  om

    String userId = getUserName(request);
    String lfcHost = RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getLfcHost();
    String gridName = RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getGridName();
    String certPath = PropertyLoader.getInstance().getProperty("portal.prefix.dir") + "users" + "/" + userId;
    /*event.getTextFieldBean("newName").setValue("");
    event.getTextFieldBean("dirName").setValue("");
         *
         */
    if (!userCertCheckMG(userId, gridName)) {
        /*   response.setRenderParameter("message", "No valid certificate for " + gridName);
           viewGridResources(request, getSelectedGridForUser(userId), getSelectedVOForUser(userId));
                
           response.setRenderParameter("showErrorButton", "0");
           //response.setRenderParameter("showFileBrowser", "0");
           response.setRenderParameter("userID", userId);
                
           //setNextState(req, "file/File.jsp");
           return;
         *
         */
    }

    if (gridName.equals("All") || lfcHost == null || lfcHost.equals("")) {
        /*   response.setRenderParameter("message", "Select a VO and an LFCHOST");
           viewGridResources(request, getSelectedGridForUser(userId), getSelectedVOForUser(userId));
           response.setRenderParameter("showFileBrowser", "0");
           response.setRenderParameter("userID", userId);
                
           //setNextState(req, "file/File.jsp");
           return;
         *
         */
    }
    String path = "/grid/" + gridName;
    String fileName = "";

    if (((filelist == null) || filelist.equals(new String("")))) { // A file is not selected from the list

        //fillFileList(getCurrentBrowser(userId).getLastSelectedItem().getItems(), fileList, "");
        for (int i = 0; i < RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId)
                .getSelectedItems().size(); i++) {
            path = path + "/" + RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId)
                    .getSelectedItems().get(i);
        }
        /*   response.setRenderParameter("path", path);
           response.setRenderParameter("showFileBrowser", "1");
           viewGridResources(request, getSelectedGridForUser(userId), getSelectedVOForUser(userId));
           response.setRenderParameter("message", "A file is not selected");
           response.setRenderParameter("userID", userId);
                
           //setNextState(req, "file/File.jsp");
         *
                
           return;
         *
         */

        response.getWriter().write(
                "<br><br><table align=\"center\" width=\"100%\" bgcolor=\"lightblue\" ><tr align=\"center\"><td>");
        response.getWriter().write(
                "<strong>ERROR! <br><br>No file selected!<br><br> Please use \"back\" button in your browser to go back to the previous page.</strong>");
        response.getWriter().write("</td></tr></table>");

        return;

    }
    // extract the name and '+' or' -', indicating whether the item is a directory or a file
    String[] names = filelist.split("@");

    fileName = names[names.length - 1];

    /*  NO DIRECTORY DOWNLOAD */

    if (names[0].charAt(0) != '-' || names[0].trim().length() == 0) { // Selected item is not a file

        response.getWriter().write(
                "<br><br><table align=\"center\" width=\"100%\" bgcolor=\"lightblue\" ><tr align=\"center\"><td>");
        response.getWriter().write(
                "<strong>ERROR! <br><br>Selected entry is not a file!<br><br> Please use \"back\" button in your browser to go back to the previous page.</strong>");
        response.getWriter().write("</td></tr></table>");

        return;
        //response.getWriter().write("0");

        /*//fillFileList(getCurrentBrowser(userId).getLastSelectedItem().getItems(), fileList, "");
        for(int i=0;i<RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems().size();i++) {
           path = path + "/" + RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems().get(i);
        }
        response.setRenderParameter("path", path);
        response.setRenderParameter("showFileBrowser", "1");
        viewGridResources(request, getSelectedGridForUser(userId), getSelectedVOForUser(userId));
        response.setRenderParameter("userID", userId);
                
        //setNextState(req, "file/File.jsp");
        return;
                 *
                 */
    }
    String tempdir = System.getProperty("java.io.tmpdir") + "/users";
    String argument = "";
    // find the path of the selected item
    for (int i = 0; i < RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems()
            .size(); i++)
        argument = argument + " "
                + RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems().get(i);
    Process p;
    for (int i = 0; i < RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems()
            .size(); i++) {
        path = path + "/"
                + RemoteFileManagerSingleton.getInstance().getCurrentBrowser(userId).getSelectedItems().get(i);
    }
    ArrayList fList = new ArrayList();
    try {

        // save the file to the portal server
        fList.add(fileName);
        VOInfoRequester inforeq = new VOInfoRequester();
        String bdii = inforeq.getInfos(gridName).getBdii();

        p = Runtime.getRuntime()
                .exec("/bin/bash " + scripts_path + "fileDownload.sh " + scripts_path + " " + bdii + " "
                        + userId + " " + tempdir + " " + certPath + " " + lfcHost + "  " + " " + gridName + " "
                        + path + " " + fileName);
        p.waitFor();
        ///response.setRenderParameter("isDirectory", "0");
    } catch (Exception ex) {
        response.setContentType("text/plain");

        response.getWriter().write(
                "<br><br><table align=\"center\" width=\"100%\" bgcolor=\"lightblue\" ><tr align=\"center\"><td>");
        response.getWriter().write(
                "<strong>ERROR! <br><br>File cannot be downloaded!<br><br> Please use \"back\" button in your browser to go back to the previous page.</strong>");
        response.getWriter().write("</td></tr></table>");
        return;
    }

    RemoteFileManagerSingleton.getInstance().putFileList(userId, fList);
    /*response.setRenderParameter("path", path);
    response.setRenderParameter("fileNames", "true");
    response.setRenderParameter("fileName", fileName);
            
    response.setRenderParameter("userID", userId);
    response.setRenderParameter("nextJSP","/WEB-INF/jsp/file/fileDownload.jsp");
    */

    // sending file back to the browser
    File f = new File(tempdir + "/" + userId + "/fileDownloadDir/" + fileName);
    if (!f.exists()) {
        response.setContentType("text/plain");
        response.getWriter().write(
                "<br><br><table align=\"center\" width=\"100%\" bgcolor=\"lightblue\" ><tr align=\"center\"><td>");
        response.getWriter().write(
                "<strong>ERROR! <br><br>File cannot be downloaded!<br><br> Please use \"back\" button in your browser to go back to the previous page.</strong>");
        response.getWriter().write("</td></tr></table>");
        return;
    }
    int length = 0;

    //
    //  Set the response and go!
    //
    //
    response.setContentType("application/x-download");

    response.addProperty("Content-Disposition", "inline;  filename=" + fileName);

    response.setContentLength((int) f.length());
    //response.setHeader( "Content-Disposition", "attachment; filename=\"" + original_filename + "\"" );

    //
    //  Stream to the requester.
    //
    byte[] bbuf = new byte[10 * 1024];

    DataInputStream in = new DataInputStream(new FileInputStream(f));

    while ((in != null) && ((length = in.read(bbuf)) != -1)) {
        response.getPortletOutputStream().write(bbuf, 0, length);
    }

    in.close();
    response.getPortletOutputStream().flush();
    response.getPortletOutputStream().close();

    //END of Download Process

    // FileUploadProgressListener listener=(FileUploadProgressListener)
    //((PortletFileUpload)ps.getAttribute("upload",ps.APPLICATION_SCOPE)).getProgressListener();
    //      response.getWriter().write(lisener.getFileuploadstatus());

}

From source file:org.joget.apps.app.controller.ConsoleWebController.java

@RequestMapping(value = "/userview/screenshot/(*:appId)/(*:userviewId)")
public void consoleUserviewScreenshot(HttpServletRequest request, HttpServletResponse response,
        @RequestParam(value = "appId") String appId,
        @RequestParam(value = "version", required = false) String version,
        @RequestParam(value = "userviewId") String userviewId) throws IOException {
    version = (version != null) ? version : "";
    String filename = appId + "_" + version + "_" + userviewId + ".png";

    String basePath = SetupManager.getBaseDirectory();
    String dataFileBasePath = SetupManager.getSettingValue("dataFileBasePath");
    if (dataFileBasePath != null && dataFileBasePath.length() > 0) {
        basePath = dataFileBasePath;/*from   www  .ja v  a2 s .  c  o m*/
    }
    String path = basePath + "app_screenshots";

    InputStream imageInput;
    File f = new File(path, filename);
    if (!f.exists()) {
        String defaultImage = "images/sampleapp.png";
        imageInput = getClass().getClassLoader().getResourceAsStream(defaultImage);
    } else {
        imageInput = new FileInputStream(f);
    }

    response.setContentType("image/png");
    OutputStream out = response.getOutputStream();
    byte[] bbuf = new byte[65536];
    DataInputStream in = new DataInputStream(imageInput);
    try {
        int length = 0;
        while ((in != null) && ((length = in.read(bbuf)) != -1)) {
            out.write(bbuf, 0, length);
        }
    } finally {
        in.close();
        out.flush();
        out.close();
    }
}

From source file:org.joget.apps.app.controller.ConsoleWebController.java

@RequestMapping("/console/monitor/log/(*:fileName)")
public void consoleMonitorLogs(HttpServletResponse response, @RequestParam("fileName") String fileName)
        throws IOException {
    if (HostManager.isVirtualHostEnabled()) {
        response.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;//from   w  w w  .  j a  v a  2s.c  o m
    }

    ServletOutputStream stream = response.getOutputStream();

    String decodedFileName = fileName;
    try {
        decodedFileName = URLDecoder.decode(fileName, "UTF8");
    } catch (UnsupportedEncodingException e) {
        // ignore
    }

    File file = LogUtil.getTomcatLogFile(decodedFileName);
    if (file == null || file.isDirectory() || !file.exists()) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }
    DataInputStream in = new DataInputStream(new FileInputStream(file));
    byte[] bbuf = new byte[65536];

    try {
        // set attachment filename
        response.setHeader("Content-Disposition",
                "attachment; filename*=UTF-8''" + URLEncoder.encode(decodedFileName, "UTF8"));

        // send output
        int length = 0;
        while ((in != null) && ((length = in.read(bbuf)) != -1)) {
            stream.write(bbuf, 0, length);
        }
    } finally {
        in.close();
        stream.flush();
        stream.close();
    }
}

From source file:com.portfolio.data.provider.MysqlAdminProvider.java

@Override
public Object postPortfolioZip(MimeType mimeType, MimeType mimeType2, HttpServletRequest httpServletRequest,
        int userId, int groupId, String modelId) throws FileNotFoundException, IOException {
    if (!credential.isAdmin(userId))
        throw new RestWebApplicationException(Status.FORBIDDEN, "No admin right");

    DataInputStream inZip = new DataInputStream(httpServletRequest.getInputStream());

    ByteArrayOutputStream byte2 = new ByteArrayOutputStream();
    StringBuffer outTrace = new StringBuffer();

    String portfolioId = null;//from ww w  . ja  va2s .  co m
    portfolioId = httpServletRequest.getParameter("portfolio");

    String foldersfiles = null;
    String filename;
    String[] xmlFiles;
    String[] allFiles;
    String[] ImgFiles;
    int formDataLength = httpServletRequest.getContentLength();
    byte[] buff = new byte[formDataLength];

    // Recuperation de l'heure  laquelle le zip est cr
    //Calendar cal = Calendar.getInstance();
    //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss_S");
    //String now = sdf.format(cal.getTime());

    this.genererPortfolioUuidPreliminaire();

    javax.servlet.http.HttpSession session = httpServletRequest.getSession(true);
    String ppath = session.getServletContext().getRealPath(File.separator);
    String outsideDir = ppath.substring(0, ppath.lastIndexOf(File.separator)) + "_files" + File.separator;
    File outsideDirectoryFile = new File(outsideDir);
    System.out.println(outsideDir);
    // if the directory does not exist, create it
    if (!outsideDirectoryFile.exists()) {
        outsideDirectoryFile.mkdir();
    }

    //Creation du zip
    filename = outsideDir + "xml_" + this.portfolioUuidPreliminaire + ".zip";
    FileOutputStream outZip = new FileOutputStream(filename);

    int len;

    while ((len = inZip.read(buff)) != -1) {
        outZip.write(buff, 0, len);
    }

    inZip.close();
    outZip.close();

    //-- unzip --
    foldersfiles = unzip(filename, outsideDir + this.portfolioUuidPreliminaire + File.separator);
    //TODO Attention si plusieurs XML dans le fichier
    xmlFiles = findFiles(outsideDir + this.portfolioUuidPreliminaire + File.separator, "xml");
    allFiles = findFiles(outsideDir + this.portfolioUuidPreliminaire + File.separator, null);

    for (int i = 0; i < allFiles.length; i++) {
        portfolioRessourcesImportPath.add(allFiles[i]);
        String tmpFileName = allFiles[i].substring(allFiles[i].lastIndexOf(File.separator) + 1);
        String uuid = tmpFileName.substring(0, tmpFileName.indexOf("_"));
        portfolioRessourcesImportUuid.add(uuid);

        tmpFileName = allFiles[i].substring(allFiles[i].lastIndexOf(File.separator) + 1);
        String lang;
        try {
            int tmpPos = tmpFileName.indexOf("_");
            lang = tmpFileName.substring(tmpPos + 1, tmpPos + 3);
        } catch (Exception ex) {
            lang = "";
        }
        InputStream is = new FileInputStream(allFiles[i]);
        byte b[] = new byte[is.available()];
        is.read(b);
        String extension;
        try {
            extension = tmpFileName.substring(tmpFileName.lastIndexOf(".") + 1);
        } catch (Exception ex) {
            extension = null;

        }

        // trop long
        //String tmpMimeType = FileUtils.getMimeType("file://"+allFiles[i]);
        String tmpMimeType = FileUtils.getMimeTypeFromExtension(extension);

        // Attention on initialise la ligne file
        // avec l'UUID d'origine de l'asmContext parent
        // Il sera mis  jour avec l'UUID asmContext final dans writeNode
        try {
            UUID tmpUuid = UUID.fromString(uuid);

            if (tmpUuid.toString().equals(uuid))
                this.putFile(uuid, lang, tmpFileName, outsideDir, tmpMimeType, extension, b.length, b, userId);
        } catch (Exception ex) {
            // Le nom du fichier ne commence pas par un UUID,
            // ce n'est donc pas une ressource
        }
    }

    //TODO Supprimer le zip quand a fonctionnera bien

    //--- Read xml fileL ----
    for (int i = 0; i < xmlFiles.length; i++) {
        BufferedReader br = new BufferedReader(new FileReader(new File(xmlFiles[i])));
        String line;
        StringBuilder sb = new StringBuilder();

        while ((line = br.readLine()) != null) {
            sb.append(line.trim());
        }
        String xml = "?";
        xml = sb.toString();

        if (xml.contains("<portfolio id=")) {
            try {
                Object returnValue = postPortfolio(new MimeType("text/xml"), new MimeType("text/xml"), xml,
                        userId, groupId, null);
                return returnValue;
            } catch (MimeTypeParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

    return false;
}

From source file:com.portfolio.data.provider.MysqlDataProvider.java

@Override
public Object postPortfolioZip(MimeType mimeType, MimeType mimeType2, HttpServletRequest httpServletRequest,
        int userId, int groupId, String modelId, int substid) throws IOException {
    if (!credential.isAdmin(userId) && !credential.isCreator(userId))
        throw new RestWebApplicationException(Status.FORBIDDEN, "No admin right");

    boolean isMultipart = ServletFileUpload.isMultipartContent(httpServletRequest);
    // Create a factory for disk-based file items
    DiskFileItemFactory factory = new DiskFileItemFactory();

    // Configure a repository (to ensure a secure temp location is used)
    ServletContext servletContext = httpServletRequest.getSession().getServletContext();
    File repository = (File) servletContext.getAttribute("javax.servlet.context.tempdir");
    factory.setRepository(repository);//  www.j a va2  s  .  c o m

    // Create a new file upload handler
    ServletFileUpload upload = new ServletFileUpload(factory);

    DataInputStream inZip = null;
    // Parse the request
    try {
        List<FileItem> items = upload.parseRequest(httpServletRequest);
        // Process the uploaded items
        Iterator<FileItem> iter = items.iterator();
        while (iter.hasNext()) {
            FileItem item = iter.next();
            if (!item.isFormField()) {
                inZip = new DataInputStream(item.getInputStream());
                break;
            }
        }
    } catch (FileUploadException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    String foldersfiles = null;
    String filename;
    String[] xmlFiles;
    String[] allFiles;
    //      int formDataLength = httpServletRequest.getContentLength();
    byte[] buff = new byte[0x100000]; // 1MB buffer

    // Recuperation de l'heure  laquelle le zip est cr
    //Calendar cal = Calendar.getInstance();
    //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss_S");
    //String now = sdf.format(cal.getTime());

    this.genererPortfolioUuidPreliminaire();

    javax.servlet.http.HttpSession session = httpServletRequest.getSession(true);
    String ppath = session.getServletContext().getRealPath("/");
    String outsideDir = ppath.substring(0, ppath.lastIndexOf(File.separator)) + "_files" + File.separator;
    File outsideDirectoryFile = new File(outsideDir);
    System.out.println(outsideDir);
    // if the directory does not exist, create it
    if (!outsideDirectoryFile.exists()) {
        outsideDirectoryFile.mkdir();
    }

    //Creation du zip
    filename = outsideDir + "xml_" + this.portfolioUuidPreliminaire + ".zip";
    FileOutputStream outZip = new FileOutputStream(filename);

    int len;

    while ((len = inZip.read(buff)) != -1) {
        outZip.write(buff, 0, len);
    }

    inZip.close();
    outZip.close();

    //-- unzip --
    foldersfiles = unzip(filename, outsideDir + this.portfolioUuidPreliminaire + File.separator);
    //TODO Attention si plusieurs XML dans le fichier
    xmlFiles = findFiles(outsideDir + this.portfolioUuidPreliminaire + File.separator, "xml");
    allFiles = findFiles(outsideDir + this.portfolioUuidPreliminaire + File.separator, null);

    ////// Lecture du fichier de portfolio
    StringBuffer outTrace = new StringBuffer();
    //// Importation du portfolio
    //--- Read xml fileL ----
    ///// Pour associer l'ancien uuid -> nouveau, pour les fichiers
    HashMap<String, String> resolve = new HashMap<String, String>();
    String portfolioUuid = "erreur";
    boolean hasLoaded = false;
    try {
        for (int i = 0; i < xmlFiles.length; i++) {
            String xmlFilepath = xmlFiles[i];
            String xmlFilename = xmlFilepath.substring(xmlFilepath.lastIndexOf(File.separator));
            if (xmlFilename.contains("_"))
                continue; // Case when we add an xml in the portfolio

            BufferedReader br = new BufferedReader(new FileReader(new File(xmlFilepath)));
            String line;
            StringBuilder sb = new StringBuilder();

            while ((line = br.readLine()) != null) {
                sb.append(line.trim());
            }
            String xml = "?";
            xml = sb.toString();

            portfolioUuid = UUID.randomUUID().toString();

            if (xml.contains("<portfolio")) // Le porfolio (peux mieux faire)
            {
                Document doc = DomUtils.xmlString2Document(xml, outTrace);

                Node rootNode = (doc.getElementsByTagName("portfolio")).item(0);
                if (rootNode == null)
                    throw new Exception("Root Node (portfolio) not found !");
                else {
                    rootNode = (doc.getElementsByTagName("asmRoot")).item(0);

                    String uuid = UUID.randomUUID().toString();

                    insertMysqlPortfolio(portfolioUuid, uuid, 0, userId);

                    writeNode(rootNode, portfolioUuid, null, userId, 0, uuid, null, 0, 0, false, resolve);
                }
                updateMysqlPortfolioActive(portfolioUuid, true);

                /// Finalement on cre un rle designer
                int groupid = postCreateRole(portfolioUuid, "designer", userId);

                /// Ajoute la personne dans ce groupe
                putUserGroup(Integer.toString(groupid), Integer.toString(userId));

                hasLoaded = true;
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (hasLoaded)
        for (int i = 0; i < allFiles.length; i++) {
            String fullPath = allFiles[i];
            String tmpFileName = allFiles[i].substring(allFiles[i].lastIndexOf(File.separator) + 1);

            int index = tmpFileName.indexOf("_");
            if (index == -1)
                index = tmpFileName.indexOf(".");
            int last = tmpFileName.lastIndexOf(File.separator);
            if (last == -1)
                last = 0;
            String uuid = tmpFileName.substring(last, index);

            //         tmpFileName = allFiles[i].substring(allFiles[i].lastIndexOf(File.separator)+1);
            String lang;
            try {
                //            int tmpPos = tmpFileName.indexOf("_");
                lang = tmpFileName.substring(index + 1, index + 3);

                if ("un".equals(lang)) // Hack sort of fixing previous implementation
                    lang = "en";
            } catch (Exception ex) {
                lang = "";
            }

            InputStream is = new FileInputStream(allFiles[i]);
            byte b[] = new byte[is.available()];
            is.read(b);
            String extension;
            try {
                extension = tmpFileName.substring(tmpFileName.lastIndexOf(".") + 1);
            } catch (Exception ex) {
                extension = null;
            }

            // trop long
            //String tmpMimeType = FileUtils.getMimeType("file://"+allFiles[i]);
            String tmpMimeType = FileUtils.getMimeTypeFromExtension(extension);

            // Attention on initialise la ligne file
            // avec l'UUID d'origine de l'asmContext parent
            // Il sera mis  jour avec l'UUID asmContext final dans writeNode
            try {
                UUID tmpUuid = UUID.fromString(uuid); /// base uuid
                String resolved = resolve.get(uuid); /// New uuid
                String sessionval = session.getId();
                String user = (String) session.getAttribute("user");
                //            String test = outsideDir+File.separator+this.portfolioUuidPreliminaire+File.separator+tmpFileName;
                //            File file = new File(outsideDir+File.separator+this.portfolioUuidPreliminaire+File.separator+tmpFileName);
                File file = new File(fullPath);

                // server backend
                // fileserver
                String backend = session.getServletContext().getInitParameter("backendserver");

                if (resolved != null) {
                    /// Have to send it in FORM, compatibility with regular file posting
                    PostForm.sendFile(sessionval, backend, user, resolved, lang, file);

                    /// No need to fetch resulting ID, since we provided it
                    /*
                    InputStream objReturn = connect.getInputStream();
                    StringWriter idResponse = new StringWriter();
                    IOUtils.copy(objReturn, idResponse);
                    fileid = idResponse.toString();
                    //*/
                }

                /*
                if(tmpUuid.toString().equals(uuid))
                   this.putFile(uuid,lang,tmpFileName,outsideDir,tmpMimeType,extension,b.length,b,userId);
                //*/
            } catch (Exception ex) {
                // Le nom du fichier ne commence pas par un UUID,
                // ce n'est donc pas une ressource
                ex.printStackTrace();
            }
        }

    File zipfile = new File(filename);
    zipfile.delete();
    File zipdir = new File(outsideDir + this.portfolioUuidPreliminaire + File.separator);
    zipdir.delete();

    return portfolioUuid;
}