Class ContentSummary

java.lang.Object
org.apache.hadoop.fs.QuotaUsage
org.apache.hadoop.fs.ContentSummary
All Implemented Interfaces:
Writable

@Public @Evolving public class ContentSummary extends QuotaUsage implements Writable
Store the summary of a content (a directory or a file).
  • Constructor Details

    • ContentSummary

      @Deprecated public ContentSummary()
      Deprecated.
      Constructor deprecated by ContentSummary.Builder
    • ContentSummary

      @Deprecated public ContentSummary(long length, long fileCount, long directoryCount)
      Deprecated.
      Constructor, deprecated by ContentSummary.Builder This constructor implicitly set spaceConsumed the same as length. spaceConsumed and length must be set explicitly with ContentSummary.Builder.
      Parameters:
      length - length.
      fileCount - file count.
      directoryCount - directory count.
    • ContentSummary

      @Deprecated public ContentSummary(long length, long fileCount, long directoryCount, long quota, long spaceConsumed, long spaceQuota)
      Deprecated.
      Constructor, deprecated by ContentSummary.Builder.
      Parameters:
      length - length.
      fileCount - file count.
      directoryCount - directory count.
      quota - quota.
      spaceConsumed - space consumed.
      spaceQuota - space quota.
  • Method Details

    • getLength

      public long getLength()
      Returns:
      the length
    • getSnapshotLength

      public long getSnapshotLength()
    • getDirectoryCount

      public long getDirectoryCount()
      Returns:
      the directory count
    • getSnapshotDirectoryCount

      public long getSnapshotDirectoryCount()
    • getFileCount

      public long getFileCount()
      Returns:
      the file count
    • getSnapshotFileCount

      public long getSnapshotFileCount()
    • getSnapshotSpaceConsumed

      public long getSnapshotSpaceConsumed()
    • getErasureCodingPolicy

      public String getErasureCodingPolicy()
    • write

      @Private public void write(DataOutput out) throws IOException
      Description copied from interface: Writable
      Serialize the fields of this object to out.
      Specified by:
      write in interface Writable
      Parameters:
      out - DataOuput to serialize this object into.
      Throws:
      IOException - any other problem for write.
    • readFields

      @Private public void readFields(DataInput in) throws IOException
      Description copied from interface: Writable
      Deserialize the fields of this object from in.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Specified by:
      readFields in interface Writable
      Parameters:
      in - DataInput to deseriablize this object from.
      Throws:
      IOException - any other problem for readFields.
    • equals

      public boolean equals(Object to)
      Overrides:
      equals in class QuotaUsage
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class QuotaUsage
    • getHeader

      public static String getHeader(boolean qOption)
      Return the header of the output. if qOption is false, output directory count, file count, and content size; if qOption is true, output quota and remaining quota as well.
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      Returns:
      the header of the output
    • getErasureCodingPolicyHeader

      public static String getErasureCodingPolicyHeader()
    • getSnapshotHeader

      public static String getSnapshotHeader()
    • getHeaderFields

      public static String[] getHeaderFields()
      Returns the names of the fields from the summary header.
      Returns:
      names of fields as displayed in the header
    • getQuotaHeaderFields

      public static String[] getQuotaHeaderFields()
      Returns the names of the fields used in the quota summary.
      Returns:
      names of quota fields as displayed in the header
    • toString

      public String toString()
      Overrides:
      toString in class QuotaUsage
    • toString

      public String toString(boolean qOption)
      Return the string representation of the object in the output format. if qOption is false, output directory count, file count, and content size; if qOption is true, output quota and remaining quota as well.
      Overrides:
      toString in class QuotaUsage
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      Returns:
      the string representation of the object
    • toString

      public String toString(boolean qOption, boolean hOption)
      Return the string representation of the object in the output format. For description of the options,
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      hOption - a flag indicating if human readable output if to be used
      Returns:
      the string representation of the object
      See Also:
    • toString

      public String toString(boolean qOption, boolean hOption, boolean xOption)
      Return the string representation of the object in the output format. For description of the options,
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      hOption - a flag indicating if human readable output is to be used
      xOption - a flag indicating if calculation from snapshots is to be included in the output
      Returns:
      the string representation of the object
      See Also:
    • toString

      public String toString(boolean qOption, boolean hOption, boolean tOption, List<StorageType> types)
      Return the string representation of the object in the output format. For description of the options,
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      hOption - a flag indicating if human readable output if to be used
      tOption - a flag indicating if display quota by storage types
      types - Storage types to display
      Returns:
      the string representation of the object
      See Also:
    • toString

      public String toString(boolean qOption, boolean hOption, boolean tOption, boolean xOption, List<StorageType> types)
      Return the string representation of the object in the output format. if qOption is false, output directory count, file count, and content size; if qOption is true, output quota and remaining quota as well. if hOption is false, file sizes are returned in bytes if hOption is true, file sizes are returned in human readable if tOption is true, display the quota by storage types if tOption is false, same logic with #toString(boolean,boolean) if xOption is false, output includes the calculation from snapshots if xOption is true, output excludes the calculation from snapshots
      Parameters:
      qOption - a flag indicating if quota needs to be printed or not
      hOption - a flag indicating if human readable output is to be used
      tOption - a flag indicating if display quota by storage types
      xOption - a flag indicating if calculation from snapshots is to be included in the output
      types - Storage types to display
      Returns:
      the string representation of the object
    • toErasureCodingPolicy

      public String toErasureCodingPolicy()
      Returns:
      Constant-width String representation of Erasure Coding Policy
    • toSnapshot

      public String toSnapshot(boolean hOption)
      Return the string representation of the snapshot counts in the output format.
      Parameters:
      hOption - flag indicating human readable or not
      Returns:
      String representation of the snapshot counts