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, isSymlink
public LocalFileSystem()
LocalFileSystem
object.public void setWorkingDirectory(Path path)
FileSystem
setWorkingDirectory
in class FileSystem
public Path getWorkingDirectory()
FileSystem
getWorkingDirectory
in class FileSystem
public java.net.URI getUri()
FileSystem
getUri
in class FileSystem
public void initialize(java.net.URI name) throws java.io.IOException
FileSystem
initialize
in class FileSystem
name
- a URI
whose authority section names the host, port, etc.
for this file systemjava.io.IOException
public FileStatus getFileStatus(Path f) throws java.io.IOException
FileSystem
getFileStatus
in class FileSystem
f
- The path we want information fromjava.io.FileNotFoundException
- when the path does not exist;
IOException see specific implementationjava.io.IOException
public FileStatus[] listFiles(Path f) throws java.io.IOException
FileSystem
listFiles
in class FileSystem
f
- given pathjava.io.IOException
public FSDataInputStream open(Path f) throws java.io.IOException
FileSystem
open
in class FileSystem
f
- the file to openjava.io.IOException
public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws java.io.IOException
FileSystem
getFileBlockLocations
in class FileSystem
java.io.IOException
public FSDataInputStream open(Path path, int bufferSize) throws java.io.IOException
open
in class FileSystem
java.io.IOException
public FSDataOutputStream create(Path filePath) throws java.io.IOException
FileSystem
create
in class FileSystem
filePath
- pathjava.io.IOException
- if an error occurspublic FSDataOutputStream create(Path filePath, FileSystem.WriteMode writeMode) throws java.io.IOException
FileSystem
create
in class FileSystem
filePath
- 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 FileSystem
java.io.IOException
public FileStatus[] listStatus(Path f) throws java.io.IOException
listStatus
in class FileSystem
java.io.IOException
public boolean mkdirs(Path f) throws java.io.IOException
mkdirs
in class FileSystem
java.io.IOException
public boolean exists(Path path) throws java.io.IOException
FileSystem
exists
in class FileSystem
java.io.IOException
public boolean rename(Path src, Path dst) throws java.io.IOException
rename
in class FileSystem
java.io.IOException
public long getDefaultBlockSize()
getDefaultBlockSize
in class FileSystem
public boolean isDistributedFS()
isDistributedFS
in class FileSystem