Package com.alibaba.citrus.util.FileUtil

Examples of com.alibaba.citrus.util.FileUtil.FileNameAndExtension


        return false;
    }

    @Override
    public String doMapping(String name) {
        FileNameAndExtension names = getFileNameAndExtension(name, true);
        String extension = names.getExtension(); // ����Ϊnull

        if (extension == null) {
            extension = EMPTY_STRING;
        } else {
            extension = extension.toLowerCase();
        }

        // ���ӳ�������ڣ����滻��׺
        if (extensionMappings.containsKey(extension)) {
            String mapToExtension = extensionMappings.get(extension);

            name = names.getFileName(); // �ܲ�Ϊnull

            // �����/��β���Ͳ��Ӻ�׺��
            if (name.length() == 0 || !StringUtil.contains(NAME_SEPARATOR, name.charAt(name.length() - 1))) {
                // �����ȡ��ӳ���׺��Ϊ�գ�����Ϻ�׺
                if (!StringUtil.isEmpty(mapToExtension)) {
                    name = name + EXTENSION_SEPARATOR + mapToExtension;
                }
            }
        } else {
            // ����׺����ӳ������У��Һ�׺Ϊ�գ������������Ƶ�ǰ��
            if (StringUtil.isEmpty(extension)) {
                name = names.getFileName();
            }
        }

        return name;
    }
View Full Code Here


    public TemplateKey(String templateName, TemplateSearchingStrategy[] strategies) {
        templateName = assertNotNull(trimToNull(normalizeAbsolutePath(templateName)), "illegal templateName: %s",
                templateName);

        FileNameAndExtension names = getFileNameAndExtension(templateName, true);

        this.templateNameWithoutExtension = names.getFileName();
        this.extension = names.getExtension();

        if (isEmptyArray(strategies)) {
            this.strategyKeys = EMPTY_OBJECT_ARRAY;
        } else {
            this.strategyKeys = new Object[strategies.length];
View Full Code Here

        return false;
    }

    @Override
    public String doMapping(String name) {
        FileNameAndExtension names = getFileNameAndExtension(name, true);
        String extension = names.getExtension(); // ����Ϊnull

        if (extension == null) {
            extension = EMPTY_STRING;
        } else {
            extension = extension.toLowerCase();
        }

        // ���ӳ�������ڣ����滻��׺
        if (extensionMappings.containsKey(extension)) {
            String mapToExtension = extensionMappings.get(extension);

            name = names.getFileName(); // �ܲ�Ϊnull

            // �����/��β���Ͳ��Ӻ�׺��
            if (name.length() == 0 || !StringUtil.contains(NAME_SEPARATOR, name.charAt(name.length() - 1))) {
                // �����ȡ��ӳ���׺��Ϊ�գ�����Ϻ�׺
                if (!StringUtil.isEmpty(mapToExtension)) {
                    name = name + EXTENSION_SEPARATOR + mapToExtension;
                }
            }
        } else {
            // ����׺����ӳ������У��Һ�׺Ϊ�գ������������Ƶ�ǰ��
            if (StringUtil.isEmpty(extension)) {
                name = names.getFileName();
            }
        }

        return name;
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.FileUtil.FileNameAndExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.