Example usage for org.apache.commons.io FilenameUtils getName

List of usage examples for org.apache.commons.io FilenameUtils getName

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils getName.

Prototype

public static String getName(String filename) 

Source Link

Document

Gets the name minus the path from a full filename.

Usage

From source file:cop.raml.mocks.TypeElementMock.java

public TypeElementMock setQualifiedName(String qualifiedName) {
    this.qualifiedName = qualifiedName != null ? new NameMock(qualifiedName) : null;
    setName(qualifiedName != null ? FilenameUtils.getName(qualifiedName) : null);
    return this;
}

From source file:codes.thischwa.c5c.requestcycle.response.mode.Download.java

@Override
@JsonIgnore/*from ww w .j  a v  a2  s .c o  m*/
public void write(HttpServletResponse resp) throws IOException {
    resp.setHeader("Content-Type", "application/x-download");
    resp.setHeader("Content-Transfer-Encoding", "Binary");
    resp.setHeader("Content-Length", String.valueOf(contentLength));
    resp.setHeader("Content-Disposition",
            String.format("attachment; filename=\"%s\"", FilenameUtils.getName(fullPath)));
    IOUtils.copy(in, resp.getOutputStream());
}

From source file:net.bpelunit.framework.control.deploy.activebpel.BPRDeployRequestEntity.java

@Override
protected void populateMessage(SOAPMessage message) throws SOAPException, IOException {
    SOAPElement xmlDeployBpr = addRootElement(message, new QName(ACTIVEBPEL_ELEMENT_DEPLOYBPR));

    // Add filename
    SOAPElement xmlBprFilename = xmlDeployBpr.addChildElement(ACTIVEBPEL_ELEMENT_ABPRFILENAME);
    xmlBprFilename.addAttribute(new QName(ActiveBPELRequestEntityBase.NS_XMLSCHEMA_INSTANCE, "type"),
            XSD_STRING);/*from   w ww. j  a va2 s.  co m*/
    xmlBprFilename.setTextContent(FilenameUtils.getName(file.toString()));

    // Add data
    SOAPElement xmlBase64File = xmlDeployBpr.addChildElement(ACTIVEBPEL_ELEMENT_ABASE64FILE);
    xmlBase64File.addAttribute(new QName(ActiveBPELRequestEntityBase.NS_XMLSCHEMA_INSTANCE, "type"),
            XSD_STRING);

    StringBuilder content = new StringBuilder();
    byte[] arr = FileUtils.readFileToByteArray(file);
    byte[] encoded = Base64.encodeBase64Chunked(arr);
    for (int i = 0; i < encoded.length; i++) {
        content.append((char) encoded[i]);
    }
    xmlBase64File.setTextContent(content.toString());
}

From source file:IO.Files.java

/**
 * Return the file name include extension
 *
 * @param filename a file name without the full path
 * @return the file name include extension
 *///  w  w w .j  a va2s . com
public static String GetFileNameWithExtension(String filename) {
    return FilenameUtils.getName(filename);
}

From source file:br.com.caelum.vraptor.observer.upload.CommonsUploadedFile.java

@Override
public String getFileName() {
    return FilenameUtils.getName(delegate.getName());
}

From source file:com.frostwire.android.gui.transfers.DesktopTransferItem.java

@Override
public String getDisplayName() {
    return FilenameUtils.getName(fd.filePath);
}

From source file:net.sf.jvifm.control.RemoveCommand.java

public void execute() {

    String[] options = new String[] { msgOptionYes, msgOptionNo, msgOptionCancel };

    String result = new Util().openConfirmWindow(options, msgRmConfirmDlgTitle, msgFileDelete,
            OptionShell.WARN);//  w w  w.j a va  2  s. c o  m

    if (result == null)
        return;
    if (!result.equals(msgOptionYes))
        return;

    try {
        for (int i = 0; i < files.length; i++) {
            String baseName = FilenameUtils.getName(files[i]);
            updateStatusInfo("deleting file " + baseName);
            fileModelManager.rm(files[i]);
        }
    } catch (Exception e) {
        Util.openMessageWindow(e.getMessage());
        return;
    }
    return;

}

From source file:com.blackducksoftware.ohcount4j.SourceFile.java

public String getName() {
    return FilenameUtils.getName(path);
}

From source file:com.iisigroup.cap.response.FileDownloadResult.java

public FileDownloadResult(IRequest request, String file, String outputName, String contentType) {
    this._request = request;
    this._file = file;
    this._outputName = CapString.isEmpty(outputName) ? FilenameUtils.getName(_file) : outputName;
    this._contentType = contentType;
}

From source file:com.orange.wro.taglib.config.GroupLoader.java

@Override
public Map<ResourceType, String> getMinimizedResources() {
    Map<ResourceType, String> res = new HashMap<ResourceType, String>();
    String groupName = group.getName();
    Set<String> resourcePaths = wroTagLibConfig.getResourcePaths();

    if (resourcePaths != null) {
        for (String path : resourcePaths) {
            String fileName = FilenameUtils.getName(path);
            String group = wroTagLibConfig.getGroupForFile(fileName);

            if (group != null) {
                if (groupName.equals(FilenameUtils.getBaseName(group))) {
                    String type = FilenameUtils.getExtension(group);
                    res.put(ResourceType.get(type), path);
                }// w  w w  . j a v  a 2 s .co m

            } else {
                if (FilenameUtils.getBaseName(path).startsWith(groupName)) {
                    String type = FilenameUtils.getExtension(path);
                    res.put(ResourceType.get(type), path);
                }
            }
        }
    }

    return res;
}