ddiff
Version 1.0.0

com.ehsbe.ddiff
Class DirEntry

java.lang.Object
  extended by com.ehsbe.ddiff.DirEntry
Direct Known Subclasses:
Dir

public class DirEntry
extends Object

A simple caching container for file information.

Version:
$Revision: 395 $
Author:
Jens Elkner

Nested Class Summary
Modifier and Type Class and Description
static class DirEntry.Type
          types of file, we distignuish.
 
Field Summary
Modifier and Type Field and Description
 java.nio.file.attribute.BasicFileAttributes attr
          the file attributes for this instance.
 java.nio.file.Path opath
          the original path associated with this entry.
 java.nio.file.Path path
          the path associated with this entry.
 
Constructor Summary
Constructor and Description
DirEntry(java.nio.file.Path path, boolean resolve, java.nio.file.attribute.BasicFileAttributes attrs)
          Create a new instance.
 
Method Summary
Modifier and Type Method and Description
 String getName()
          Get the basename of this entry in the original directory.
 DirEntry.Type getType()
          Get the type of the entry.
static DirEntry.Type getType(java.nio.file.Path path, java.nio.file.attribute.BasicFileAttributes attributes)
          Get the type of an dir entry depending on its file attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

public final java.nio.file.Path path
the path associated with this entry.


opath

public final java.nio.file.Path opath
the original path associated with this entry. Same as path if this is not a symlink


attr

public final java.nio.file.attribute.BasicFileAttributes attr
the file attributes for this instance. Might be null.

Constructor Detail

DirEntry

public DirEntry(java.nio.file.Path path,
                boolean resolve,
                java.nio.file.attribute.BasicFileAttributes attrs)
Create a new instance.

Parameters:
path - path associated with this instance.
resolve - if true resolve the path to its final destination, if it is a symlink.
attrs - file attributes for this instance. Might be null.
Method Detail

getName

public String getName()
Get the basename of this entry in the original directory.

Returns:
the original basename

getType

public DirEntry.Type getType()
Get the type of the entry.

Returns:
the type of the file, but never null.

getType

public static DirEntry.Type getType(java.nio.file.Path path,
                                    java.nio.file.attribute.BasicFileAttributes attributes)
Get the type of an dir entry depending on its file attributes.

Parameters:
path - the path to analyze
attributes - file attributes to use. If null, attributes are retrieved on the fly.
Returns:
the type wrt.the given file attributes, but never null.

ddiff
Version 1.0.0

Created by Jens Elkner