[TOC]

org.apache.nutch.util

Class FSUtils


public class FSUtils
extends Object

Utility methods for common filesystem operations.

Constructor Summary

Constructors Constructor and Description FSUtils()

Method Summary

Methods Modifier and Type Method and Description static void closeReaders(org.apache.hadoop.io.MapFile.Reader[] readers) Closes a group of MapFile readers. static void closeReaders(org.apache.hadoop.io.SequenceFile.Reader[] readers) Closes a group of SequenceFile readers. static void replace(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path current, org.apache.hadoop.fs.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(org.apache.hadoop.fs.FileSystem fs,
           org.apache.hadoop.fs.Path current,
           org.apache.hadoop.fs.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:
  - <code>fs</code> - The FileSystem.
  - <code>current</code> - The end path, the one being replaced.
  - <code>replacement</code> - The path to replace with.
  - <code>removeOld</code> - True if we are removing the current path. 
  - Throws: 
  - <code>IOException</code> - If an error occurs during replacement.       
-  

closeReaders

public static void closeReaders(org.apache.hadoop.io.SequenceFile.Reader[] readers)
                         throws IOException

Closes a group of SequenceFile readers.

  - Parameters:
  - <code>readers</code> - The SequenceFile readers to close. 
  - Throws: 
  - <code>IOException</code> - If an error occurs while closing a reader.       
-  

closeReaders

public static void closeReaders(org.apache.hadoop.io.MapFile.Reader[] readers)
                         throws IOException

Closes a group of MapFile readers.

  - Parameters:
  - <code>readers</code> - The MapFile readers to close. 
  - Throws: 
  - <code>IOException</code> - If an error occurs while closing a reader.      

Copyright © 2014 The Apache Software Foundation