This commit is contained in:
Christian P. MOMON 2010-08-02 14:28:15 +02:00
parent 6e72560ba7
commit d05bb8fd84
2 changed files with 47 additions and 4 deletions

View file

@ -1,6 +1,7 @@
package fr.devinsy.util; package fr.devinsy.util;
import java.io.File; import java.io.File;
import java.util.Iterator; import java.util.Iterator;
import java.util.Vector; import java.util.Vector;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -240,7 +241,8 @@ public class FileIterator extends Vector<FileIteratorState> implements Iterator<
static public boolean isLink(File file) throws Exception static public boolean isLink(File file) throws Exception
{ {
boolean result; boolean result;
if (file.getCanonicalPath().equals(file.getAbsolutePath()))
if ((file.exists()) && (file.getCanonicalPath().equals(file.getAbsolutePath())))
{ {
result = false; result = false;
} }
@ -390,8 +392,7 @@ public class FileIterator extends Vector<FileIteratorState> implements Iterator<
int result; int result;
result = 0; result = 0;
File f; while (this.next() != null)
while ((f = this.next()) != null)
{ {
result += 1; result += 1;
} }
@ -401,6 +402,48 @@ public class FileIterator extends Vector<FileIteratorState> implements Iterator<
} }
/**
*
*/
public int fileFinalCountdown()
{
int result;
result = 0;
while (this.hasNext())
{
if (!this.next().isDirectory())
{
result += 1;
}
}
//
return(result);
}
/**
*
*/
public int directoryFinalCountdown()
{
int result;
result = 0;
while (this.hasNext())
{
if (this.next().isDirectory())
{
result += 1;
}
}
//
return(result);
}
/** /**
* *
*/ */

View file

@ -6,7 +6,7 @@ import java.util.regex.Pattern;
/** /**
* * Used by FileIterator class.
*/ */
public class FileIteratorState implements Iterator<File> public class FileIteratorState implements Iterator<File>
{ {