Sha256: 5f772f3024b4067b2ff1cb6b3945ef1d6198a4ba5c56feb5712db16a4134ba20

Contents?: true

Size: 836 Bytes

Versions: 6

Compression:

Stored size: 836 Bytes

Contents

package org.sunflow.system;

import java.io.File;
import java.util.Locale;

public final class FileUtils {

    /**
     * Extract the file extension from the specified filename.
     *
     * @param filename filename to get the extension of
     * @return a string representing the file extension, or <code>null</code> if
     * the filename doesn't have any extension, or is not a file
     */
    public static String getExtension(String filename) {
        if (filename == null) {
            return null;
        }
        File f = new File(filename);
        if (f.isDirectory()) {
            return null;
        }
        String name = new File(filename).getName();
        int idx = name.lastIndexOf('.');
        return idx == -1 ? null : name.substring(idx + 1).toLowerCase(Locale.ENGLISH);
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
joonsrenderer-1.3.1-java src/main/java/org/sunflow/system/FileUtils.java
joonsrenderer-1.2.0-java src/main/java/org/sunflow/system/FileUtils.java
joonsrenderer-1.1.3-java src/main/java/org/sunflow/system/FileUtils.java
joonsrenderer-1.1.2-java src/main/java/org/sunflow/system/FileUtils.java
joonsrenderer-1.1.1-java src/main/java/org/sunflow/system/FileUtils.java
joonsrenderer-1.1-java src/main/java/org/sunflow/system/FileUtils.java