Example usage for com.liferay.portal.kernel.util FileUtil decodeSafeFileName

List of usage examples for com.liferay.portal.kernel.util FileUtil decodeSafeFileName

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util FileUtil decodeSafeFileName.

Prototype

public static String decodeSafeFileName(String fileName) 

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java

License:Open Source License

public String[] getFileNames(long companyId, long repositoryId) throws SystemException {

    String[] fileNames = _store.getFileNames(companyId, repositoryId);

    String[] decodedFileNames = new String[fileNames.length];

    for (int i = 0; i < fileNames.length; i++) {
        decodedFileNames[i] = FileUtil.decodeSafeFileName(fileNames[i]);
    }//from   w  w  w  .  j av a  2 s.  co m

    return decodedFileNames;
}

From source file:com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.java

License:Open Source License

public String[] getFileNames(long companyId, long repositoryId, String dirName)
        throws PortalException, SystemException {

    String safeDirName = FileUtil.encodeSafeFileName(dirName);

    if (!safeDirName.equals(dirName)) {
        try {//from   www  .  j  a  v  a2 s . c o m
            _store.move(dirName, safeDirName);
        } catch (Exception e) {
        }
    }

    String[] fileNames = _store.getFileNames(companyId, repositoryId, safeDirName);

    String[] decodedFileNames = new String[fileNames.length];

    for (int i = 0; i < fileNames.length; i++) {
        decodedFileNames[i] = FileUtil.decodeSafeFileName(fileNames[i]);
    }

    return decodedFileNames;
}