public class HadoopFileSystem extends FileSystem implements java.io.Closeable
FileSystem.WriteMode| Constructor and Description |
|---|
HadoopFileSystem(org.apache.hadoop.conf.Configuration hadoopConfig,
org.apache.hadoop.fs.FileSystem hadoopfileSystem) |
| Modifier and Type | Method and Description |
|---|---|
HadoopDataOutputStream |
append(Path path) |
void |
close() |
HadoopDataOutputStream |
create(Path f)
Create a file system with the OVERWRITE
|
FSDataOutputStream |
create(Path f,
FileSystem.WriteMode writeMode)
Create a file system with the specific write mdoe
|
boolean |
delete(Path f,
boolean recursive) |
boolean |
exists(Path f)
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)
It returns the status of the file respective to the path given by the user.
|
org.apache.hadoop.fs.FileSystem |
getHadoopFileSystem() |
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) |
HadoopDataInputStream |
open(Path f)
This method open and return the input stream object respective to the path
|
HadoopDataInputStream |
open(Path f,
int bufferSize) |
boolean |
rename(Path src,
Path dst) |
void |
setWorkingDirectory(Path path1)
Set the working Directory
|
isDirectory, isFile, isSymlinkpublic HadoopFileSystem(org.apache.hadoop.conf.Configuration hadoopConfig,
org.apache.hadoop.fs.FileSystem hadoopfileSystem)
public org.apache.hadoop.fs.FileSystem getHadoopFileSystem()
public Path getWorkingDirectory()
getWorkingDirectory in class FileSystempublic void setWorkingDirectory(Path path1)
setWorkingDirectory in class FileSystempublic java.net.URI getUri()
FileSystemgetUri in class FileSystempublic void initialize(java.net.URI name)
initialize in class FileSystemname - a URI whose authority section names the host, port, etc.
for this file systempublic FileStatus getFileStatus(Path f) throws java.io.IOException
getFileStatus in class FileSystemf - The path we want information fromjava.io.FileNotFoundException - when the path does not exist;
IOException see specific implementationjava.io.IOExceptionpublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws java.io.IOException
FileSystemgetFileBlockLocations in class FileSystemjava.io.IOExceptionpublic HadoopDataInputStream open(Path f, int bufferSize) throws java.io.IOException
open in class FileSystemjava.io.IOExceptionpublic HadoopDataInputStream open(Path f) throws java.io.IOException
open in class FileSystemf - Open an data input stream at the indicated pathjava.io.IOExceptionpublic HadoopDataOutputStream create(Path f) throws java.io.IOException
FileSystemcreate in class FileSystemf - pathjava.io.IOException - if an error occurspublic FSDataOutputStream create(Path f, FileSystem.WriteMode writeMode) throws java.io.IOException
FileSystemcreate in class FileSystemf - pathwriteMode - weather overwrite or not, when creating new filesjava.io.IOException - if an error occurspublic HadoopDataOutputStream append(Path path) throws java.io.IOException
java.io.IOExceptionpublic boolean delete(Path f, boolean recursive) throws java.io.IOException
delete in class FileSystemjava.io.IOExceptionpublic boolean exists(Path f) throws java.io.IOException
FileSystemexists 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 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 FileSystempublic FileStatus[] listFiles(Path f) throws java.io.IOException
listFiles in class FileSystemf - given pathjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException