return readAttributes( "*" );
}
@Override
public Map<String, Object> readAttributes( final String... attributes ) {
final BasicFileAttributes attrs = readAttributes();
return new HashMap<String, Object>() {{
for ( final String attribute : attributes ) {
checkNotEmpty( "attribute", attribute );
if ( attribute.equals( "*" ) || attribute.equals( IS_REGULAR_FILE ) ) {
put( IS_REGULAR_FILE, attrs.isRegularFile() );
}
if ( attribute.equals( "*" ) || attribute.equals( IS_DIRECTORY ) ) {
put( IS_DIRECTORY, attrs.isDirectory() );
}
if ( attribute.equals( "*" ) || attribute.equals( IS_SYMBOLIC_LINK ) ) {
put( IS_SYMBOLIC_LINK, attrs.isSymbolicLink() );
}
if ( attribute.equals( "*" ) || attribute.equals( IS_OTHER ) ) {
put( IS_OTHER, attrs.isOther() );
}
if ( attribute.equals( "*" ) || attribute.equals( SIZE ) ) {
put( SIZE, new Long( attrs.size() ) );
}
if ( attribute.equals( "*" ) || attribute.equals( FILE_KEY ) ) {
put( FILE_KEY, attrs.fileKey() );
}
if ( attribute.equals( "*" ) || attribute.equals( LAST_MODIFIED_TIME ) ) {
put( LAST_MODIFIED_TIME, attrs.lastModifiedTime() );
}
if ( attribute.equals( "*" ) || attribute.equals( LAST_ACCESS_TIME ) ) {
put( LAST_ACCESS_TIME, attrs.lastAccessTime() );
}
if ( attribute.equals( "*" ) || attribute.equals( CREATION_TIME ) ) {
put( CREATION_TIME, attrs.creationTime() );
}
if ( attribute.equals( "*" ) ) {
break;
}
}