org.apache.hadoop.fs
Class RawLocalFileSystem

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.fs.FileSystem
          extended by org.apache.hadoop.fs.RawLocalFileSystem
All Implemented Interfaces:
Configurable

public class RawLocalFileSystem
extends FileSystem

Implement the FileSystem API for the raw local filesystem.


Field Summary
 
Fields inherited from class org.apache.hadoop.fs.FileSystem
LOG
 
Constructor Summary
RawLocalFileSystem()
           
 
Method Summary
 void close()
          No more filesystem operations are needed.
 void completeLocalOutput(Path fsWorkingFile, Path tmpLocalFile)
          Called when we're all done writing to the target.
 FSDataOutputStream create(Path f, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress)
          Opens an FSDataOutputStream at the indicated Path with write-progress reporting.
 boolean delete(Path p)
          Delete a file
 boolean exists(Path f)
          Check if exists.
 FileStatus getFileStatus(Path f)
           
 String getName()
          Deprecated.  
 URI getUri()
          Returns a URI whose scheme and authority identify this FileSystem.
 Path getWorkingDirectory()
          Get the current working directory for the given file system
 void initialize(URI uri, Configuration conf)
          Called after a new FileSystem instance is constructed.
 FileStatus[] listStatus(Path f)
           
 void lock(Path p, boolean shared)
          Deprecated.  
 boolean mkdirs(Path f)
          Creates the specified directory hierarchy.
 void moveFromLocalFile(Path src, Path dst)
          The src file is on the local disk.
 FSDataInputStream open(Path f, int bufferSize)
          Opens an FSDataInputStream at the indicated Path.
 File pathToFile(Path path)
          Convert a path to a File.
 void release(Path p)
          Deprecated.  
 boolean rename(Path src, Path dst)
          Renames Path src to Path dst.
 void setWorkingDirectory(Path newDir)
          Set the working directory to the given directory.
 Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile)
          Returns a local File that the user can write output to.
 String toString()
           
 
Methods inherited from class org.apache.hadoop.fs.FileSystem
checkPath, closeAll, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, createNewFile, get, get, getBlockSize, getContentLength, getDefaultBlockSize, getDefaultReplication, getFileCacheHints, getLength, getLocal, getNamed, getReplication, getUsed, globPaths, globPaths, isDirectory, isFile, listPaths, listPaths, listPaths, listPaths, makeQualified, moveToLocalFile, open, parseArgs, setReplication
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RawLocalFileSystem

public RawLocalFileSystem()
Method Detail

pathToFile

public File pathToFile(Path path)
Convert a path to a File.


getName

public String getName()
Deprecated. 

Overrides:
getName in class FileSystem

getUri

public URI getUri()
Description copied from class: FileSystem
Returns a URI whose scheme and authority identify this FileSystem.

Specified by:
getUri in class FileSystem

initialize

public void initialize(URI uri,
                       Configuration conf)
Description copied from class: FileSystem
Called after a new FileSystem instance is constructed.

Specified by:
initialize in class FileSystem
Parameters:
uri - a uri whose authority section names the host, port, etc. for this FileSystem
conf - the configuration

open

public FSDataInputStream open(Path f,
                              int bufferSize)
                       throws IOException
Description copied from class: FileSystem
Opens an FSDataInputStream at the indicated Path.

Specified by:
open in class FileSystem
Parameters:
f - the file name to open
bufferSize - the size of the buffer to be used.
Throws:
IOException

create

public FSDataOutputStream create(Path f,
                                 boolean overwrite,
                                 int bufferSize,
                                 short replication,
                                 long blockSize,
                                 Progressable progress)
                          throws IOException
Description copied from class: FileSystem
Opens an FSDataOutputStream at the indicated Path with write-progress reporting.

Specified by:
create in class FileSystem
Parameters:
f - the file name to open
overwrite - if a file with this name already exists, then if true, the file will be overwritten, and if false an error will be thrown.
bufferSize - the size of the buffer to be used.
replication - required block replication for the file.
Throws:
IOException

rename

public boolean rename(Path src,
                      Path dst)
               throws IOException
Description copied from class: FileSystem
Renames Path src to Path dst. Can take place on local fs or remote DFS.

Specified by:
rename in class FileSystem
Throws:
IOException

delete

public boolean delete(Path p)
               throws IOException
Description copied from class: FileSystem
Delete a file

Specified by:
delete in class FileSystem
Throws:
IOException

exists

public boolean exists(Path f)
               throws IOException
Description copied from class: FileSystem
Check if exists.

Specified by:
exists in class FileSystem
Parameters:
f - source file
Throws:
IOException

listStatus

public FileStatus[] listStatus(Path f)
                        throws IOException
Specified by:
listStatus in class FileSystem
Throws:
IOException

mkdirs

public boolean mkdirs(Path f)
               throws IOException
Creates the specified directory hierarchy. Does not treat existence as an error.

Specified by:
mkdirs in class FileSystem
Throws:
IOException

setWorkingDirectory

public void setWorkingDirectory(Path newDir)
Set the working directory to the given directory.

Specified by:
setWorkingDirectory in class FileSystem

getWorkingDirectory

public Path getWorkingDirectory()
Description copied from class: FileSystem
Get the current working directory for the given file system

Specified by:
getWorkingDirectory in class FileSystem
Returns:
the directory pathname

lock

@Deprecated
public void lock(Path p,
                            boolean shared)
          throws IOException
Deprecated. 

Throws:
IOException

release

@Deprecated
public void release(Path p)
             throws IOException
Deprecated. 

Throws:
IOException

moveFromLocalFile

public void moveFromLocalFile(Path src,
                              Path dst)
                       throws IOException
Description copied from class: FileSystem
The src file is on the local disk. Add it to FS at the given dst name, removing the source afterwards.

Overrides:
moveFromLocalFile in class FileSystem
Throws:
IOException

startLocalOutput

public Path startLocalOutput(Path fsOutputFile,
                             Path tmpLocalFile)
                      throws IOException
Description copied from class: FileSystem
Returns a local File that the user can write output to. The caller provides both the eventual FS target name and the local working file. If the FS is local, we write directly into the target. If the FS is remote, we write into the tmp local area.

Overrides:
startLocalOutput in class FileSystem
Throws:
IOException

completeLocalOutput

public void completeLocalOutput(Path fsWorkingFile,
                                Path tmpLocalFile)
                         throws IOException
Description copied from class: FileSystem
Called when we're all done writing to the target. A local FS will do nothing, because we've written to exactly the right place. A remote FS will copy the contents of tmpLocalFile to the correct target at fsOutputFile.

Overrides:
completeLocalOutput in class FileSystem
Throws:
IOException

close

public void close()
           throws IOException
Description copied from class: FileSystem
No more filesystem operations are needed. Will release any held locks.

Overrides:
close in class FileSystem
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object

getFileStatus

public FileStatus getFileStatus(Path f)
                         throws IOException
Specified by:
getFileStatus in class FileSystem
Throws:
IOException


Copyright © 2006 The Apache Software Foundation