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, startLocalOutput
getConf, setConf
public 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
FileSystem
initialize
在类中 FileSystem
uri
- a uri whose authority section names the host, port, etc.
for this FileSystemconf
- the configurationIOException
protected void initDelegationToken() throws IOException
IOException
protected int getDefaultPort()
FileSystem
getDefaultPort
在类中 FileSystem
public URI getUri()
FileSystem
getUri
在类中 FileSystem
public static String getHomeDirectoryString(UserGroupInformation ugi)
public Path getHomeDirectory()
FileSystem
getHomeDirectory
在类中 FileSystem
public Path getWorkingDirectory()
FileSystem
getWorkingDirectory
在类中 FileSystem
public void setWorkingDirectory(Path dir)
FileSystem
setWorkingDirectory
在类中 FileSystem
public FileStatus getFileStatus(Path f) throws IOException
FileSystem
getFileStatus
在类中 FileSystem
f
- The path we want information fromFileNotFoundException
- when the path does not exist;
IOException see specific implementationIOException
public boolean mkdirs(Path f, FsPermission permission) throws IOException
FileSystem
mkdirs
在类中 FileSystem
IOException
public boolean rename(Path src, Path dst) throws IOException
FileSystem
rename
在类中 FileSystem
IOException
public void setOwner(Path p, String owner, String group) throws IOException
FileSystem
setOwner
在类中 FileSystem
p
- The pathowner
- If it is null, the original username remains unchanged.group
- If it is null, the original groupname remains unchanged.IOException
public void setPermission(Path p, FsPermission permission) throws IOException
FileSystem
setPermission
在类中 FileSystem
IOException
public boolean setReplication(Path p, short replication) throws IOException
FileSystem
setReplication
在类中 FileSystem
p
- file namereplication
- new replicationIOException
public void setTimes(Path p, long mtime, long atime) throws IOException
FileSystem
setTimes
在类中 FileSystem
p
- 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.IOException
public long getDefaultBlockSize()
FileSystem
getDefaultBlockSize
在类中 FileSystem
public short getDefaultReplication()
FileSystem
getDefaultReplication
在类中 FileSystem
public void concat(Path trg, Path[] srcs) throws IOException
FileSystem
concat
在类中 FileSystem
trg
- the path to the target destination.IOException
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FileSystem
create
在类中 FileSystem
f
- 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.IOException
FileSystem.setPermission(Path, FsPermission)
public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException
FileSystem
append
在类中 FileSystem
f
- the existing file to be appended.bufferSize
- the size of the buffer to be used.progress
- for reporting progress if it is not null.IOException
public boolean delete(Path f) throws IOException
delete
在类中 FileSystem
IOException
public boolean delete(Path f, boolean recursive) throws IOException
FileSystem
delete
在类中 FileSystem
f
- 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.IOException
public FSDataInputStream open(Path f, int buffersize) throws IOException
FileSystem
open
在类中 FileSystem
f
- the file name to openbuffersize
- the size of the buffer to be used.IOException
public FileStatus[] listStatus(Path f) throws IOException
FileSystem
listStatus
在类中 FileSystem
f
- given pathIOException
public Token<DelegationTokenIdentifier> getDelegationToken(String renewer) throws IOException
FileSystem
getDelegationToken
在类中 FileSystem
renewer
- the account name that is allowed to renew the token.IOException
public Token<?> getRenewToken()
getRenewToken
在接口中 DelegationTokenRenewer.Renewable
public <T extends TokenIdentifier> void setDelegationToken(Token<T> token)
DelegationTokenRenewer.Renewable
public BlockLocation[] getFileBlockLocations(FileStatus status, long offset, long length) throws IOException
FileSystem
getFileBlockLocations
在类中 FileSystem
IOException
public ContentSummary getContentSummary(Path p) throws IOException
FileSystem
ContentSummary
of a given Path
.getContentSummary
在类中 FileSystem
IOException
public MD5MD5CRC32FileChecksum getFileChecksum(Path p) throws IOException
FileSystem
getFileChecksum
在类中 FileSystem
p
- The file pathIOException
Copyright © 2009 The Apache Software Foundation