HADOOP-7886. Add toString to FileStatus. Contributed by SreeHari.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1210793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jakob Homan 2011-12-06 06:35:02 +00:00
parent b981daa07f
commit 788f28b679
2 changed files with 21 additions and 0 deletions

View File

@ -72,6 +72,8 @@ Trunk (unreleased changes)
HADOOP-7876. Provided access to encoded key in DelegationKey for
use in protobuf based RPCs. (suresh)
HADOOP-7886. Add toString to FileStatus. (SreeHari via jghoman)
BUGS
HADOOP-7606. Upgrade Jackson to version 1.7.1 to match the version required

View File

@ -331,4 +331,23 @@ public class FileStatus implements Writable, Comparable {
public int hashCode() {
return getPath().hashCode();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append("{");
sb.append("path=" + path);
sb.append("; isDirectory=" + isdir);
if(!isDirectory()){
sb.append("; length=" + length);
sb.append("; replication=" + block_replication);
sb.append("; blocksize=" + blocksize);
}
sb.append("; owner=" + owner);
sb.append("; group=" + group);
sb.append("; permission=" + permission);
sb.append("}");
return sb.toString();
}
}