public class FilterFileSystem extends FileSystem
FilterFileSystem contains
some other file system, which it uses as
its basic file system, possibly transforming
the data along the way or providing additional
functionality. The class FilterFileSystem
itself simply overrides all methods of
FileSystem with versions that
pass all requests to the contained file
system. Subclasses of FilterFileSystem
may further override some of these methods
and may also provide additional methods
and fields.FileSystem.Statistics| 限定符和类型 | 字段和说明 |
|---|---|
protected FileSystem |
fs |
FS_DEFAULT_NAME_KEY, LOG, statistics| 构造器和说明 |
|---|
FilterFileSystem() |
FilterFileSystem(FileSystem fs) |
| 限定符和类型 | 方法和说明 |
|---|---|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress)
Append to an existing file (optional operation).
|
protected void |
checkPath(Path path)
Check that a Path belongs to this FileSystem.
|
void |
close()
No more filesystem operations are needed.
|
void |
completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
Called when we're all done writing to the target.
|
void |
concat(Path f,
Path[] psrcs)
Concat existing files together.
|
void |
copyFromLocalFile(boolean delSrc,
Path src,
Path dst)
The src file is on the local disk.
|
void |
copyToLocalFile(boolean delSrc,
Path src,
Path dst)
The src file is under FS, and the dst is on the local disk.
|
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
Opens an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
boolean |
delete(Path f)
已过时。
|
boolean |
delete(Path f,
boolean recursive)
Delete a file
|
String |
getCanonicalServiceName()
Get a canonical service name for this file system.
|
Configuration |
getConf()
Return the configuration used by this object.
|
long |
getDefaultBlockSize()
Return the number of bytes that large input files should be optimally
be split into to minimize i/o time.
|
short |
getDefaultReplication()
Get the default replication.
|
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len)
Return an array containing hostnames, offset and size of
portions of the given file.
|
FileChecksum |
getFileChecksum(Path f)
Get the checksum of a file.
|
FileStatus |
getFileStatus(Path f)
Get file status.
|
Path |
getHomeDirectory()
Return the current user's home directory in this filesystem.
|
String |
getName()
已过时。
call #getUri() instead.
|
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 name,
Configuration conf)
Called after a new FileSystem instance is constructed.
|
FileStatus[] |
listStatus(Path f)
List files in a directory.
|
Path |
makeQualified(Path path)
Make sure that a path specifies a FileSystem.
|
boolean |
mkdirs(Path f,
FsPermission permission)
Make the given file and all non-existent parents into
directories.
|
FSDataInputStream |
open(Path f,
int bufferSize)
Opens an FSDataInputStream at the indicated Path.
|
boolean |
rename(Path src,
Path dst)
Renames Path src to Path dst.
|
void |
setOwner(Path p,
String username,
String groupname)
Set owner of a path (i.e. a file or a directory).
|
void |
setPermission(Path p,
FsPermission permission)
Set permission of a path.
|
boolean |
setReplication(Path src,
short replication)
Set replication for an existing file.
|
void |
setVerifyChecksum(boolean verifyChecksum)
Set the verify checksum flag.
|
void |
setWorkingDirectory(Path newDir)
Set the current working directory for the given file system.
|
Path |
startLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
Returns a local File that the user can write output to.
|
addFileSystemForTesting, append, append, clearStatistics, closeAll, closeAllForUGI, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createNonRecursive, deleteOnExit, exists, get, get, get, getAllStatistics, getBlockSize, getCacheSize, getCanonicalUri, getContentSummary, getDefaultBlockSize, getDefaultPort, getDefaultReplication, getDefaultUri, getDelegationToken, getLength, getLocal, getNamed, getReplication, getStatistics, getStatistics, getUsed, globStatus, globStatus, isDirectory, isFile, listStatus, listStatus, listStatus, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, open, printStatistics, processDeleteOnExit, setDefaultUri, setDefaultUri, setTimessetConfprotected FileSystem fs
public FilterFileSystem()
public FilterFileSystem(FileSystem fs)
public void initialize(URI name, Configuration conf) throws IOException
initialize 在类中 FileSystemname - a uri whose authority section names the host, port, etc.
for this FileSystemconf - the configurationIOExceptionpublic URI getUri()
getUri 在类中 FileSystempublic String getCanonicalServiceName()
FileSystemgetCanonicalServiceName 在类中 FileSystemSecurityUtil.buildDTServiceName(URI, int)public String getName()
getName 在类中 FileSystempublic Path makeQualified(Path path)
makeQualified 在类中 FileSystemprotected void checkPath(Path path)
checkPath 在类中 FileSystempublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException
FileSystemgetFileBlockLocations 在类中 FileSystemIOExceptionpublic FSDataInputStream open(Path f, int bufferSize) throws IOException
open 在类中 FileSystemf - the file name to openbufferSize - the size of the buffer to be used.IOExceptionpublic FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
append 在类中 FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.IOExceptionpublic void concat(Path f, Path[] psrcs) throws IOException
FileSystemconcat 在类中 FileSystemf - the path to the target destination.IOExceptionpublic FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FileSystemcreate 在类中 FileSystemf - the file name to openoverwrite - 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.IOExceptionFileSystem.setPermission(Path, FsPermission)public boolean setReplication(Path src, short replication) throws IOException
setReplication 在类中 FileSystemsrc - file namereplication - new replicationIOExceptionpublic boolean rename(Path src, Path dst) throws IOException
rename 在类中 FileSystemIOException@Deprecated public boolean delete(Path f) throws IOException
delete 在类中 FileSystemIOExceptionpublic boolean delete(Path f, boolean recursive) throws IOException
delete 在类中 FileSystemf - the path to delete.recursive - if path is a directory and set to
true, the directory is deleted else throws an exception. In
case of a file the recursive can be set to either true or false.IOExceptionpublic FileStatus[] listStatus(Path f) throws IOException
listStatus 在类中 FileSystemf - given pathIOExceptionpublic Path getHomeDirectory()
FileSystemgetHomeDirectory 在类中 FileSystempublic void setWorkingDirectory(Path newDir)
setWorkingDirectory 在类中 FileSystemnewDir - public Path getWorkingDirectory()
getWorkingDirectory 在类中 FileSystempublic boolean mkdirs(Path f, FsPermission permission) throws IOException
mkdirs 在类中 FileSystemIOExceptionpublic void copyFromLocalFile(boolean delSrc,
Path src,
Path dst)
throws IOException
copyFromLocalFile 在类中 FileSystemIOExceptionpublic void copyToLocalFile(boolean delSrc,
Path src,
Path dst)
throws IOException
copyToLocalFile 在类中 FileSystemIOExceptionpublic Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
startLocalOutput 在类中 FileSystemIOExceptionpublic void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
completeLocalOutput 在类中 FileSystemIOExceptionpublic long getDefaultBlockSize()
getDefaultBlockSize 在类中 FileSystempublic short getDefaultReplication()
getDefaultReplication 在类中 FileSystempublic FileStatus getFileStatus(Path f) throws IOException
getFileStatus 在类中 FileSystemf - The path we want information fromFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileChecksum getFileChecksum(Path f) throws IOException
getFileChecksum 在类中 FileSystemf - The file pathIOExceptionpublic void setVerifyChecksum(boolean verifyChecksum)
setVerifyChecksum 在类中 FileSystempublic Configuration getConf()
ConfigurablegetConf 在接口中 ConfigurablegetConf 在类中 Configuredpublic void close()
throws IOException
FileSystemclose 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 FileSystemIOExceptionpublic void setOwner(Path p, String username, String groupname) throws IOException
setOwner 在类中 FileSystemp - The pathusername - If it is null, the original username remains unchanged.groupname - If it is null, the original groupname remains unchanged.IOExceptionpublic void setPermission(Path p, FsPermission permission) throws IOException
setPermission 在类中 FileSystemIOExceptionCopyright © 2009 The Apache Software Foundation