本文整理了Java中edu.illinois.cs.cogcomp.core.io.IOUtils.ls()
方法的一些代码示例,展示了IOUtils.ls()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.ls()
方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.io.IOUtils
类名称:IOUtils
方法名:ls
[英]List the contents of a directory. NOTE: Order of list is not guaranteed to be consistent across runs/machines.
[中]列出目录的内容。注意:列表顺序不保证在运行/机器之间保持一致。
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
/**
* @throws Exception
*/
private void updateCurrentFiles() throws Exception {
currentSectionFiles = IOUtils.ls(combinedWSJHome + "/" + sections[currentSectionId]);
currentSectionId++;
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* @throws Exception
*/
private void updateCurrentFiles() throws Exception {
currentSectionFiles = IOUtils.ls(combinedWSJHome + "/" + sections[currentSectionId]);
currentSectionId++;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
/**
* List the directories contained within a directory.
*/
public static String[] lsDirectories(String directory) throws Exception {
String[] tmp = ls(directory);
ArrayList<String> files = new ArrayList<>();
for (String s : tmp) {
if (isDirectory(directory + File.separator + s))
files.add(s);
}
return files.toArray(new String[files.size()]);
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* List the directories contained within a directory.
*/
public static String[] lsDirectories(String directory) throws Exception {
String[] tmp = ls(directory);
ArrayList<String> files = new ArrayList<>();
for (String s : tmp) {
if (isDirectory(directory + File.separator + s))
files.add(s);
}
return files.toArray(new String[files.size()]);
}
代码示例来源:origin: CogComp/cogcomp-nlp
/**
* Empty a directory without deleting it
*
* @param directory The directory to be cleaned
* @return true only if cleaning was successful
*/
public static boolean cleanDir(String directory) throws IOException {
String[] files = ls(directory);
boolean clean = true;
// Some JVMs return null for empty dirs
if (files != null) {
for (String f : files) {
String filename = directory + File.separator + f;
File file = new File(filename);
if (file.isDirectory())
clean = cleanDir(filename) && file.delete();
else
clean = file.delete();
}
}
return clean;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
/**
* Empty a directory without deleting it
*
* @param directory The directory to be cleaned
* @return true only if cleaning was successful
*/
public static boolean cleanDir(String directory) throws IOException {
String[] files = ls(directory);
boolean clean = true;
// Some JVMs return null for empty dirs
if (files != null) {
for (String f : files) {
String filename = directory + File.separator + f;
File file = new File(filename);
if (file.isDirectory())
clean = cleanDir(filename) && file.delete();
else
clean = file.delete();
}
}
return clean;
}
代码示例来源:origin: CogComp/cogcomp-nlp
@Override
protected void initializeReader() {
String[] files = new String[0];
this.textAnnotations = new ArrayList<>();
String corpusdirectory =
this.resourceManager.getString(CorpusReaderConfigurator.SOURCE_DIRECTORY.key);
// In case the input argument is a single file
if (!IOUtils.isDirectory(corpusdirectory)) {
files = new String[] {corpusdirectory};
} else {
try {
files = IOUtils.ls(corpusdirectory);
Arrays.sort(files);
for (int i = 0; i < files.length; i++) {
files[i] = Paths.get(corpusdirectory, files[i]).toString();
}
} catch (IOException e) {
logger.error("Error listing directory.");
logger.error(e.getMessage());
}
}
try {
for (String file : files) {
textAnnotations.add(loadCoNLLfile(file));
}
} catch (IOException e) {
logger.error("Error reading file.");
logger.error(e.getMessage());
}
}
代码示例来源:origin: CogComp/talen
@Override
protected void initializeReader() {
String[] files = new String[0];
this.textAnnotations = new ArrayList<>();
String corpusdirectory =
this.resourceManager.getString(CorpusReaderConfigurator.SOURCE_DIRECTORY.key);
// In case the input argument is a single file
if (!IOUtils.isDirectory(corpusdirectory)) {
files = new String[] {corpusdirectory};
} else {
try {
files = IOUtils.ls(corpusdirectory);
Arrays.sort(files);
for (int i = 0; i < files.length; i++) {
files[i] = Paths.get(corpusdirectory, files[i]).toString();
}
} catch (IOException e) {
logger.error("Error listing directory.");
logger.error(e.getMessage());
}
}
try {
for (String file : files) {
textAnnotations.add(loadColumnfile(file));
}
} catch (IOException e) {
logger.error("Error reading file.");
logger.error(e.getMessage());
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
@Override
protected void initializeReader() {
String[] files = new String[0];
this.textAnnotations = new ArrayList<>();
String corpusdirectory =
this.resourceManager.getString(CorpusReaderConfigurator.SOURCE_DIRECTORY.key);
// In case the input argument is a single file
if (!IOUtils.isDirectory(corpusdirectory)) {
files = new String[] {corpusdirectory};
} else {
try {
files = IOUtils.ls(corpusdirectory);
Arrays.sort(files);
for (int i = 0; i < files.length; i++) {
files[i] = Paths.get(corpusdirectory, files[i]).toString();
}
} catch (IOException e) {
logger.error("Error listing directory.");
logger.error(e.getMessage());
}
}
try {
for (String file : files) {
textAnnotations.add(loadCoNLLfile(file));
}
} catch (IOException e) {
logger.error("Error reading file.");
logger.error(e.getMessage());
}
}
代码示例来源:origin: CogComp/cogcomp-nlp
} else {
try {
files = IOUtils.ls(ontonotesDirectory);
for (int i = 0; i < files.length; i++) {
files[i] = Paths.get(ontonotesDirectory, files[i]).toString();
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-corpusreaders
} else {
try {
files = IOUtils.ls(ontonotesDirectory);
for (int i = 0; i < files.length; i++) {
files[i] = Paths.get(ontonotesDirectory, files[i]).toString();
内容来源于网络,如有侵权,请联系作者删除!