PBImageDelimitedTextWriter (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.tools.offlineImageViewer, class: PBImageDelimitedTextWriter

Package org.apache.hadoop.hdfs.tools.offlineImageViewer

# Class PBImageDelimitedTextWriter

java.lang.Object
org.apache.hadoop.hdfs.tools.offlineImageViewer.PBImageDelimitedTextWriter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class PBImageDelimitedTextWriter extends Object
A PBImageDelimitedTextWriter generates a text representation of the PB fsimage, with each element separated by a delimiter string. All of the elements common to both inodes and inodes-under-construction are included. When processing an fsimage with a layout version that did not include an element, such as AccessTime, the output file will include a column for the value, but no value will be included. Individual block information for each file is not currently included. The default delimiter is tab, as this is an unlikely value to be included in an inode path or other text metadata. The delimiter value can be via the constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterOutput()`
  Method called at the end of output() phase after all the inodes with known parentPath has been printed out.
  `protected void`
  `buildNamespace(InputStream in, List<Long> refIdList)`
  Scan the INodeDirectory section to construct the namespace.
  `protected void`
  `checkNode(FsImageProto.INodeSection.INode p, AtomicInteger numDirs)`
  Checks the inode (saves if directory), and counts them.
  `void`
  `close()`
  `String`
  `getEntry(String parent, FsImageProto.INodeSection.INode inode)`
  Get text output for the given inode.
  `String`
  `getErasureCodingPolicyName(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)`
  `String`
  `getHeader()`
  Get text output for the header line.
  `protected org.apache.hadoop.fs.permission.PermissionStatus`
  `getPermission(long perm)`
  `int`
  `getStoragePolicy(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)`
  `static void`
  `mergeFiles(String[] srcPaths, String resultPath)`
  `protected PrintStream`
  `serialOutStream()`
  `void`
  `visit(String filePath)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getEntry

    public String getEntry(String parent, FsImageProto.INodeSection.INode inode)
    Get text output for the given inode.
    Parameters:
      `parent` - the path of parent directory
      `inode` - the INode object to output.

  - ### getHeader

    public String getHeader()
    Get text output for the header line.

  - ### afterOutput

    public void afterOutput()
    Method called at the end of output() phase after all the inodes with known parentPath has been printed out. Can be used to print additional data depending on the written inodes.

  - ### serialOutStream

    protected PrintStream serialOutStream()

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`

  - ### visit

    public void visit(String filePath) throws IOException
    Throws:
      `IOException`

  - ### getPermission

    protected org.apache.hadoop.fs.permission.PermissionStatus getPermission(long perm)

  - ### checkNode

    protected void checkNode(FsImageProto.INodeSection.INode p, AtomicInteger numDirs) throws IOException
    Checks the inode (saves if directory), and counts them. Can be overridden if additional steps are taken when iterating through INodeSection.
    Throws:
      `IOException`

  - ### buildNamespace

    protected void buildNamespace(InputStream in, List<Long> refIdList) throws IOException
    Scan the INodeDirectory section to construct the namespace.
    Throws:
      `IOException`

  - ### getStoragePolicy

    public int getStoragePolicy(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)

  - ### mergeFiles

    public static void mergeFiles(String[] srcPaths, String resultPath) throws IOException
    Parameters:
      `srcPaths` - Source files of contents to be merged
      `resultPath` - Merged file path
    Throws:
      `IOException`

  - ### getErasureCodingPolicyName

    public String getErasureCodingPolicyName(FsImageProto.INodeSection.XAttrFeatureProto xattrFeatureProto)