public class WebHdfsFileSystem extends FileSystem implements DelegationTokenRenewer.Renewable
| 限定符和类型 | 类和说明 |
|---|---|
static class |
WebHdfsFileSystem.DtRenewer
Delegation token renewer.
|
FileSystem.Statistics| 限定符和类型 | 字段和说明 |
|---|---|
static AbstractDelegationTokenSelector<DelegationTokenIdentifier> |
DT_SELECTOR
Token selector
|
static org.apache.commons.logging.Log |
LOG |
static String |
PATH_PREFIX
Http URI: http://namenode:port/{PATH_PREFIX}/path/to/file
|
static String |
SCHEME
File System URI: {SCHEME}://namenode:port/path/to/file
|
static Text |
TOKEN_KIND
Delegation token kind
|
static int |
VERSION
WebHdfs version.
|
FS_DEFAULT_NAME_KEY, statistics| 构造器和说明 |
|---|
WebHdfsFileSystem() |
| 限定符和类型 | 方法和说明 |
|---|---|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress)
Append to an existing file (optional operation).
|
void |
concat(Path trg,
Path[] srcs)
Concat existing files together.
|
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.
|
ContentSummary |
getContentSummary(Path p)
Return the
ContentSummary of a given Path. |
long |
getDefaultBlockSize()
Return the number of bytes that large input files should be optimally
be split into to minimize i/o time.
|
protected int |
getDefaultPort()
Get the default port for this file system.
|
short |
getDefaultReplication()
Get the default replication.
|
Token<DelegationTokenIdentifier> |
getDelegationToken(String renewer)
Get a new delegation token for this file system.
|
BlockLocation[] |
getFileBlockLocations(FileStatus status,
long offset,
long length)
Return an array containing hostnames, offset and size of
portions of the given file.
|
MD5MD5CRC32FileChecksum |
getFileChecksum(Path p)
Get the checksum of a file.
|
FileStatus |
getFileStatus(Path f)
Return a file status object that represents the path.
|
Path |
getHomeDirectory()
Return the current user's home directory in this filesystem.
|
static String |
getHomeDirectoryString(UserGroupInformation ugi) |
Token<?> |
getRenewToken() |
URI |
getUri()
Returns a URI whose scheme and authority identify this FileSystem.
|
Path |
getWorkingDirectory()
Get the current working directory for the given file system
|
protected void |
initDelegationToken() |
void |
initialize(URI uri,
Configuration conf)
Called after a new FileSystem instance is constructed.
|
static boolean |
isEnabled(Configuration conf,
org.apache.commons.logging.Log log)
Is WebHDFS enabled in conf?
|
FileStatus[] |
listStatus(Path f)
List the statuses of the files/directories in the given path if the path is
a directory.
|
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.
|
<T extends TokenIdentifier> |
setDelegationToken(Token<T> token)
Set delegation token.
|
void |
setOwner(Path p,
String owner,
String group)
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 p,
short replication)
Set replication for an existing file.
|
void |
setTimes(Path p,
long mtime,
long atime)
Set access time of a file
|
void |
setWorkingDirectory(Path dir)
Set the current working directory for the given file system.
|
addFileSystemForTesting, append, append, checkPath, clearStatistics, close, closeAll, closeAllForUGI, completeLocalOutput, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createNonRecursive, deleteOnExit, exists, get, get, get, getAllStatistics, getBlockSize, getCacheSize, getCanonicalServiceName, getCanonicalUri, getDefaultBlockSize, getDefaultReplication, getDefaultUri, getLength, getLocal, getName, getNamed, getReplication, getStatistics, getStatistics, getUsed, globStatus, globStatus, isDirectory, isFile, listStatus, listStatus, listStatus, makeQualified, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, open, printStatistics, processDeleteOnExit, setDefaultUri, setDefaultUri, setVerifyChecksum, startLocalOutputgetConf, setConfpublic static final org.apache.commons.logging.Log LOG
public static final String SCHEME
public static final int VERSION
public static final String PATH_PREFIX
public static final Text TOKEN_KIND
public static final AbstractDelegationTokenSelector<DelegationTokenIdentifier> DT_SELECTOR
public static boolean isEnabled(Configuration conf, org.apache.commons.logging.Log log)
public void initialize(URI uri, Configuration conf) throws IOException
FileSysteminitialize 在类中 FileSystemuri - a uri whose authority section names the host, port, etc.
for this FileSystemconf - the configurationIOExceptionprotected void initDelegationToken()
throws IOException
IOExceptionprotected int getDefaultPort()
FileSystemgetDefaultPort 在类中 FileSystempublic URI getUri()
FileSystemgetUri 在类中 FileSystempublic static String getHomeDirectoryString(UserGroupInformation ugi)
public Path getHomeDirectory()
FileSystemgetHomeDirectory 在类中 FileSystempublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory 在类中 FileSystempublic void setWorkingDirectory(Path dir)
FileSystemsetWorkingDirectory 在类中 FileSystempublic FileStatus getFileStatus(Path f) throws IOException
FileSystemgetFileStatus 在类中 FileSystemf - The path we want information fromFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic boolean mkdirs(Path f, FsPermission permission) throws IOException
FileSystemmkdirs 在类中 FileSystemIOExceptionpublic boolean rename(Path src, Path dst) throws IOException
FileSystemrename 在类中 FileSystemIOExceptionpublic void setOwner(Path p, String owner, String group) throws IOException
FileSystemsetOwner 在类中 FileSystemp - The pathowner - If it is null, the original username remains unchanged.group - If it is null, the original groupname remains unchanged.IOExceptionpublic void setPermission(Path p, FsPermission permission) throws IOException
FileSystemsetPermission 在类中 FileSystemIOExceptionpublic boolean setReplication(Path p, short replication) throws IOException
FileSystemsetReplication 在类中 FileSystemp - file namereplication - new replicationIOExceptionpublic void setTimes(Path p, long mtime, long atime) throws IOException
FileSystemsetTimes 在类中 FileSystemp - The pathmtime - Set the modification time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set modification time.atime - Set the access time of this file.
The number of milliseconds since Jan 1, 1970.
A value of -1 means that this call should not set access time.IOExceptionpublic long getDefaultBlockSize()
FileSystemgetDefaultBlockSize 在类中 FileSystempublic short getDefaultReplication()
FileSystemgetDefaultReplication 在类中 FileSystempublic void concat(Path trg, Path[] srcs) throws IOException
FileSystemconcat 在类中 FileSystemtrg - 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 FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
FileSystemappend 在类中 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 boolean delete(Path f) throws IOException
delete 在类中 FileSystemIOExceptionpublic boolean delete(Path f, boolean recursive) throws IOException
FileSystemdelete 在类中 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 FSDataInputStream open(Path f, int buffersize) throws IOException
FileSystemopen 在类中 FileSystemf - the file name to openbuffersize - the size of the buffer to be used.IOExceptionpublic FileStatus[] listStatus(Path f) throws IOException
FileSystemlistStatus 在类中 FileSystemf - given pathIOExceptionpublic Token<DelegationTokenIdentifier> getDelegationToken(String renewer) throws IOException
FileSystemgetDelegationToken 在类中 FileSystemrenewer - the account name that is allowed to renew the token.IOExceptionpublic Token<?> getRenewToken()
getRenewToken 在接口中 DelegationTokenRenewer.Renewablepublic <T extends TokenIdentifier> void setDelegationToken(Token<T> token)
DelegationTokenRenewer.Renewablepublic BlockLocation[] getFileBlockLocations(FileStatus status, long offset, long length) throws IOException
FileSystemgetFileBlockLocations 在类中 FileSystemIOExceptionpublic ContentSummary getContentSummary(Path p) throws IOException
FileSystemContentSummary of a given Path.getContentSummary 在类中 FileSystemIOExceptionpublic MD5MD5CRC32FileChecksum getFileChecksum(Path p) throws IOException
FileSystemgetFileChecksum 在类中 FileSystemp - The file pathIOExceptionCopyright © 2009 The Apache Software Foundation