FileStatus implements Writable, Comparable<Object>,
    Serializable, ObjectInputValidation { @Override public boolean equals(Object o) { if (!(o instanceof FileStatus)) { return false; } if (this == o) { return true; } FileStatus other = (FileStatus)o; return this.getPath().equals(other.getPath()); } FileStatus();  FileStatus(long length, boolean isdir, int block_replication,
                    long blocksize, long modification_time, Path path);  FileStatus(long length, boolean isdir,
                    int block_replication,
                    long blocksize, long modification_time, long access_time,
                    FsPermission permission, String owner, String group, 
                    Path path);  FileStatus(long length, boolean isdir,
                    int block_replication,
                    long blocksize, long modification_time, long access_time,
                    FsPermission permission, String owner, String group, 
                    Path symlink,
                    Path path);  FileStatus(long length, boolean isdir, int block_replication,
      long blocksize, long modification_time, long access_time,
      FsPermission permission, String owner, String group, Path symlink,
      Path path, boolean hasAcl, boolean isEncrypted, boolean isErasureCoded);  FileStatus(long length, boolean isdir, int block_replication,
      long blocksize, long modification_time, long access_time,
      FsPermission permission, String owner, String group, Path symlink,
      Path path, Set<AttrFlags> attr);  FileStatus(FileStatus other); static Set<AttrFlags> attributes(boolean acl, boolean crypt,
                                          boolean ec, boolean sn); long getLen(); boolean isFile(); boolean isDirectory(); @Deprecated final boolean isDir(); boolean isSymlink(); long getBlockSize(); short getReplication(); long getModificationTime(); long getAccessTime(); FsPermission getPermission(); boolean hasAcl(); boolean isEncrypted(); boolean isErasureCoded(); boolean isSnapshotEnabled(); String getOwner(); String getGroup(); Path getPath(); void setPath(final Path p); Path getSymlink(); void setSymlink(final Path p); int compareTo(FileStatus o); @Override int compareTo(Object o); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override @Deprecated void readFields(DataInput in); @Override @Deprecated void write(DataOutput out); @Override void validateObject(); static final Set<AttrFlags> NONE; }
@Test public void testEquals() { Path path = new Path("path"); FileStatus fileStatus1 = new FileStatus(1, true, 1, 1, 1, 1, FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path); FileStatus fileStatus2 = new FileStatus(2, true, 2, 2, 2, 2, FsPermission.valueOf("---x--x--x"), "two", "two", null, path); assertEquals(fileStatus1, fileStatus2); }
@Test public void testNotEquals() { Path path1 = new Path("path1"); Path path2 = new Path("path2"); FileStatus fileStatus1 = new FileStatus(1, true, 1, 1, 1, 1, FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path1); FileStatus fileStatus2 = new FileStatus(1, true, 1, 1, 1, 1, FsPermission.valueOf("-rw-rw-rw-"), "one", "one", null, path2); assertFalse(fileStatus1.equals(fileStatus2)); assertFalse(fileStatus2.equals(fileStatus1)); }