Here you can find the source of getAllFiles(String sDirectoryPath)
Parameter | Description |
---|---|
sDirectoryPath | The directory path <p> |
private static String[] getAllFiles(String sDirectoryPath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**//from w w w . ja va 2s .c o m * Returns the set of all files in the given directory * <p> * * @param sDirectoryPath * The directory path * <p> * @return The required list of files */ private static String[] getAllFiles(String sDirectoryPath) { if (sDirectoryPath == null) { return new String[0]; } File fileThisDirectory = new File(sDirectoryPath); if (fileThisDirectory.isDirectory() == false) { return new String[0]; } else { String[] asFileList = fileThisDirectory.list(); if (asFileList == null || asFileList.length == 0) { return asFileList; } return asFileList; } } }