public class LocalFileSystem extends FileSystem
FileSystem.WriteMode| Constructor and Description |
|---|
LocalFileSystem()
Constructs a new
LocalFileSystem object. |
| Modifier and Type | Method and Description |
|---|---|
FSDataOutputStream |
create(Path filePath)
Create a file system with the OVERWRITE
|
FSDataOutputStream |
create(Path filePath,
FileSystem.WriteMode writeMode)
Create a file system with the specific write mdoe
|
boolean |
delete(Path f,
boolean recursive) |
boolean |
exists(Path path)
Check if the given path exsits
|
long |
getDefaultBlockSize() |
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len)
Return an array containing hostnames, offset and size of
portions of the given file.
|
FileStatus |
getFileStatus(Path f)
Return a file status object that represents the path.
|
java.net.URI |
getUri()
Returns a URI whose scheme and authority identify this file system.
|
Path |
getWorkingDirectory()
Get the working Directory
|
void |
initialize(java.net.URI name)
Called after a new FileSystem instance is constructed.
|
boolean |
isDistributedFS() |
FileStatus[] |
listFiles(Path f)
List the statuses of the files/directories in the given path if the path is
a directory.
|
FileStatus[] |
listStatus(Path f) |
boolean |
mkdirs(Path f) |
FSDataInputStream |
open(Path f)
Opens an FSDataInputStream at the indicated Path.
|
FSDataInputStream |
open(Path path,
int bufferSize) |
boolean |
rename(Path src,
Path dst) |
void |
setWorkingDirectory(Path path)
Set the working Directory
|
isDirectory, isFile, isSymlinkpublic LocalFileSystem()
LocalFileSystem object.public void setWorkingDirectory(Path path)
FileSystemsetWorkingDirectory in class FileSystempublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory in class FileSystempublic java.net.URI getUri()
FileSystemgetUri in class FileSystempublic void initialize(java.net.URI name)
throws java.io.IOException
FileSysteminitialize in class FileSystemname - a URI whose authority section names the host, port, etc.
for this file systemjava.io.IOExceptionpublic FileStatus getFileStatus(Path f) throws java.io.IOException
FileSystemgetFileStatus in class FileSystemf - The path we want information fromjava.io.FileNotFoundException - when the path does not exist;
IOException see specific implementationjava.io.IOExceptionpublic FileStatus[] listFiles(Path f) throws java.io.IOException
FileSystemlistFiles in class FileSystemf - given pathjava.io.IOExceptionpublic FSDataInputStream open(Path f) throws java.io.IOException
FileSystemopen in class FileSystemf - the file to openjava.io.IOExceptionpublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws java.io.IOException
FileSystemgetFileBlockLocations in class FileSystemjava.io.IOExceptionpublic FSDataInputStream open(Path path, int bufferSize) throws java.io.IOException
open in class FileSystemjava.io.IOExceptionpublic FSDataOutputStream create(Path filePath) throws java.io.IOException
FileSystemcreate in class FileSystemfilePath - pathjava.io.IOException - if an error occurspublic FSDataOutputStream create(Path filePath, FileSystem.WriteMode writeMode) throws java.io.IOException
FileSystemcreate in class FileSystemfilePath - pathwriteMode - weather overwrite or not, when creating new filesjava.io.IOException - if an error occurspublic boolean delete(Path f, boolean recursive) throws java.io.IOException
delete in class FileSystemjava.io.IOExceptionpublic FileStatus[] listStatus(Path f) throws java.io.IOException
listStatus in class FileSystemjava.io.IOExceptionpublic boolean mkdirs(Path f) throws java.io.IOException
mkdirs in class FileSystemjava.io.IOExceptionpublic boolean exists(Path path) throws java.io.IOException
FileSystemexists in class FileSystemjava.io.IOExceptionpublic boolean rename(Path src, Path dst) throws java.io.IOException
rename in class FileSystemjava.io.IOExceptionpublic long getDefaultBlockSize()
getDefaultBlockSize in class FileSystempublic boolean isDistributedFS()
isDistributedFS in class FileSystem