Package 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
  Description
  `FSUtils()`

- ## Method Summary

  Modifier and Type
  Method
  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 Details

  - ### FSUtils

    public FSUtils()

- ## Method Details

  - ### 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.