org.apache.nutch.util

## Class FSUtils

- java.lang.Object
- - org.apache.nutch.util.FSUtils

-     public class FSUtils
      extends Object

  Utility methods for common filesystem operations.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FSUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `closeReaders(MapFile.Reader[] readers)` Closes a group of MapFile readers.
    `static void` | `closeReaders(SequenceFile.Reader[] readers)` Closes a group of SequenceFile readers.
    `static void` | `replace(FileSystem fs, Path current, Path replacement, boolean removeOld)` Replaces the current path with the new path and if set removes the old path.

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

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

- - ### Constructor Detail

    - #### FSUtils

          public FSUtils()

  - ### Method Detail

    - #### replace

          public static void replace(FileSystem fs,
                                     Path current,
                                     Path replacement,
                                     boolean removeOld)
                              throws IOException

      Replaces the current path with the new path and if set removes the old path. If removeOld is set to false then the old path will be set to the name current.old.
      Parameters:
        `fs` - The FileSystem.
        `current` - The end path, the one being replaced.
        `replacement` - The path to replace with.
        `removeOld` - True if we are removing the current path.
      Throws:
        `IOException` - If an error occurs during replacement.

    - #### closeReaders

          public static void closeReaders(SequenceFile.Reader[] readers)
                                   throws IOException

      Closes a group of SequenceFile readers.
      Parameters:
        `readers` - The SequenceFile readers to close.
      Throws:
        `IOException` - If an error occurs while closing a reader.

    - #### closeReaders

          public static void closeReaders(MapFile.Reader[] readers)
                                   throws IOException

      Closes a group of MapFile readers.
      Parameters:
        `readers` - The MapFile readers to close.
      Throws:
        `IOException` - If an error occurs while closing a reader.

Copyright © 2021 The Apache Software Foundation