java.io.Closeable, java.lang.AutoCloseable, Configurable, BulkDeleteSource, PathCapabilities, DelegationTokenIssuerpublic class HarFileSystem extends FileSystem
FileSystem.DirectoryEntries, FileSystem.DirListingIterator<T extends FileStatus>, FileSystem.Statistics| Modifier and Type | Field | Description |
|---|---|---|
static int |
METADATA_CACHE_ENTRIES_DEFAULT |
|
static java.lang.String |
METADATA_CACHE_ENTRIES_KEY |
|
static int |
VERSION |
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIXTOKEN_LOG| Constructor | Description |
|---|---|
HarFileSystem() |
public construction of harfilesystem
|
HarFileSystem(FileSystem fs) |
Constructor to create a HarFileSystem with an
underlying filesystem.
|
| Modifier and Type | Method | Description |
|---|---|---|
FSDataOutputStream |
append(Path f) |
Append to an existing file (optional operation).
|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress) |
Append to an existing file (optional operation).
|
FSDataOutputStreamBuilder |
appendFile(Path path) |
Create a Builder to append a file.
|
protected java.net.URI |
canonicalizeUri(java.net.URI uri) |
Canonicalize the given URI.
|
protected void |
checkPath(Path path) |
Check that a Path belongs to this FileSystem.
|
void |
close() |
Close this FileSystem instance.
|
void |
completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile) |
not implemented.
|
void |
copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path[] srcs,
Path dst) |
The src files are on the local disk.
|
void |
copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path src,
Path dst) |
not implemented.
|
void |
copyToLocalFile(boolean delSrc,
Path src,
Path dst) |
copies the file in the har filesystem to a local file.
|
FSDataOutputStream |
create(Path f,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress) |
Create an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
FSDataOutputStreamBuilder |
createFile(Path path) |
Create a new FSDataOutputStreamBuilder for the file with path.
|
FSDataOutputStream |
createNonRecursive(Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress) |
Opens an FSDataOutputStream at the indicated Path with write-progress
reporting.
|
protected PathHandle |
createPathHandle(FileStatus stat,
Options.HandleOpt... opts) |
Hook to implement support for
PathHandle operations. |
boolean |
delete(Path f,
boolean recursive) |
Not implemented.
|
protected java.net.URI |
getCanonicalUri() |
Used for delegation token related functionality.
|
FileSystem[] |
getChildFileSystems() |
Used for delegation token related functionality.
|
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.
|
long |
getDefaultBlockSize(Path f) |
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.
|
short |
getDefaultReplication(Path f) |
Get the default replication for a path.
|
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len) |
Get block locations from the underlying fs and fix their
offsets and lengths.
|
FileChecksum |
getFileChecksum(Path f,
long length) |
Get the checksum of a file, from the beginning of the file till the
specific length.
|
FileStatus |
getFileStatus(Path f) |
return the filestatus of files in har archive.
|
static int |
getHarHash(Path p) |
the hash of the path p inside the filesystem
|
int |
getHarVersion() |
|
Path |
getHomeDirectory() |
return the top level archive path.
|
Path |
getInitialWorkingDirectory() |
Note: with the new FileContext class, getWorkingDirectory()
will be removed.
|
java.lang.String |
getScheme() |
Return the protocol scheme for the FileSystem.
|
FsServerDefaults |
getServerDefaults() |
Return a set of server default configuration values.
|
FsServerDefaults |
getServerDefaults(Path f) |
Return a set of server default configuration values.
|
FsStatus |
getStatus(Path p) |
Returns a status object describing the use and capacity of the
filesystem.
|
java.net.URI |
getUri() |
Returns the uri of this filesystem.
|
long |
getUsed() |
Return the total size of all files in the filesystem.
|
long |
getUsed(Path path) |
Return the total size of all files from a specified path.
|
Path |
getWorkingDirectory() |
return the top level archive.
|
boolean |
hasPathCapability(Path path,
java.lang.String capability) |
Declare that this filesystem connector is always read only.
|
void |
initialize(java.net.URI name,
Configuration conf) |
Initialize a Har filesystem per har archive.
|
FileStatus[] |
listStatus(Path f) |
liststatus returns the children of a directory
after looking up the index files.
|
Path |
makeQualified(Path path) |
Qualify a path to one which uses this FileSystem and, if relative,
made absolute.
|
boolean |
mkdirs(Path f,
FsPermission permission) |
not implemented.
|
void |
msync() |
Synchronize client metadata state.
|
FSDataInputStream |
open(PathHandle fd,
int bufferSize) |
Open an FSDataInputStream matching the PathHandle instance.
|
FSDataInputStream |
open(Path f,
int bufferSize) |
Returns a har input stream which fakes end of
file.
|
boolean |
rename(Path src,
Path dst) |
Renames Path src to Path dst.
|
Path |
resolvePath(Path p) |
Return the fully-qualified path of path, resolving the path
through any symlinks or mount point.
|
void |
setOwner(Path p,
java.lang.String username,
java.lang.String groupname) |
not implemented.
|
void |
setPermission(Path p,
FsPermission permission) |
Not implemented.
|
boolean |
setReplication(Path src,
short replication) |
Not implemented.
|
void |
setTimes(Path p,
long mtime,
long atime) |
Set access time of a file.
|
void |
setWorkingDirectory(Path newDir) |
Set the current working directory for the given FileSystem.
|
Path |
startLocalOutput(Path fsOutputFile,
Path tmpLocalFile) |
not implemented.
|
boolean |
truncate(Path f,
long newLength) |
Not implemented.
|
access, append, append, append, areSymlinksEnabled, cancelDeleteOnExit, clearStatistics, closeAll, closeAllForUGI, concat, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createBulkDelete, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createFid, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createPathId, createSnapshot, createSnapshot, createSymlink, delete, deleteFid, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAclStatus, getAdditionalTokenIssuers, getAllStatistics, getAllStoragePolicies, getBlockSize, getCanonicalServiceName, getContentSummary, getDefaultPort, getDefaultUri, getDelegationToken, getEnclosingRoot, getFileBlockLocations, getFileChecksum, getFileLinkStatus, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getJobTrackerAddrs, getLength, getLinkTarget, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getStatistics, getStatistics, getStatus, getStoragePolicy, getStorageStatistics, getTrashRoot, getTrashRoots, getXAttr, getXAttrs, getXAttrs, getZkConnectString, globStatus, globStatus, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, listXAttrs, mkdirs, mkdirs, mkdirsFid, mkdirsFid, modifyAclEntries, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, open, openFid, openFid, openFid2, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameSnapshot, resolveLink, satisfyStoragePolicy, setAcl, setDefaultUri, setDefaultUri, setOwnerFid, setQuota, setQuotaByStorageType, setStoragePolicy, setVerifyChecksum, setWriteChecksum, setXAttr, setXAttr, supportsSymlinks, unsetStoragePolicysetConfclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDelegationTokenspublic static final java.lang.String METADATA_CACHE_ENTRIES_KEY
public static final int METADATA_CACHE_ENTRIES_DEFAULT
public static final int VERSION
public HarFileSystem()
public HarFileSystem(FileSystem fs)
fs - underlying file systempublic java.lang.String getScheme()
getScheme in class FileSystemharpublic void initialize(java.net.URI name,
Configuration conf)
throws java.io.IOException
initialize in class FileSystemname - a URI whose authority section names the host, port, etc.
for this FileSystemconf - the configurationjava.io.IOException - on any failure to initialize this instance.public Configuration getConf()
ConfigurablegetConf in interface ConfigurablegetConf in class Configuredpublic int getHarVersion()
throws java.io.IOException
java.io.IOExceptionpublic Path getWorkingDirectory()
getWorkingDirectory in class FileSystempublic Path getInitialWorkingDirectory()
FileSystemgetInitialWorkingDirectory in class FileSystempublic FsStatus getStatus(Path p) throws java.io.IOException
FileSystemgetStatus in class FileSystemp - Path for which status should be obtained. null means
the default partition.java.io.IOException - see specific implementationprotected java.net.URI getCanonicalUri()
getCanonicalUri in class FileSystemFileSystem.canonicalizeUri(URI)protected java.net.URI canonicalizeUri(java.net.URI uri)
FileSystemFileSystem.getDefaultPort() returns a
default port.canonicalizeUri in class FileSystemuri - url.NetUtils.getCanonicalUri(URI, int)public java.net.URI getUri()
getUri in class FileSystemprotected void checkPath(Path path)
FileSystemcheckPath in class FileSystempath - to checkpublic Path resolvePath(Path p) throws java.io.IOException
FileSystemresolvePath in class FileSystemp - path to be resolvedjava.io.FileNotFoundException - if the path is not presentjava.io.IOException - for any other errorpublic Path makeQualified(Path path)
FileSystemmakeQualified in class FileSystempath - to qualify.Path.makeQualified(URI, Path)public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws java.io.IOException
getFileBlockLocations in class FileSystemfile - the input file status to get block locationsstart - the start of the desired range in the contained filelen - the length of the desired rangejava.io.IOException - raised on errors performing I/O.public static int getHarHash(Path p)
p - the path in the harfilesystempublic FileStatus getFileStatus(Path f) throws java.io.IOException
getFileStatus in class FileSystemf - the path in har filesystemjava.io.IOException - raised on errors performing I/O.public void msync()
throws java.io.IOException,
java.lang.UnsupportedOperationException
FileSystemIn some FileSystem implementations such as HDFS metadata synchronization is essential to guarantee consistency of read requests particularly in HA setting.
msync in class FileSystemjava.io.IOException - If an I/O error occurred.java.lang.UnsupportedOperationException - if the operation is unsupported.public FileChecksum getFileChecksum(Path f, long length)
FileSystemgetFileChecksum in class FileSystemf - The file pathlength - The length of the file range for checksum calculationpublic FSDataInputStream open(Path f, int bufferSize) throws java.io.IOException
open in class FileSystemf - the file name to openbufferSize - the size of the buffer to be used.java.io.IOException - IO failureprotected PathHandle createPathHandle(FileStatus stat, Options.HandleOpt... opts)
FileSystemPathHandle operations.createPathHandle in class FileSystemstat - Referent in the target FileSystemopts - Constraints that determine the validity of the
PathHandle reference.public FSDataInputStream open(PathHandle fd, int bufferSize) throws java.io.IOException
FileSystemopen in class FileSystemfd - PathHandle object returned by the FS authority.bufferSize - the size of the buffer to useInvalidPathHandleException - If PathHandle constraints are
not satisfiedjava.io.IOException - IO failurepublic FileSystem[] getChildFileSystems()
getChildFileSystems in class FileSystempublic FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws java.io.IOException
FileSystemcreate in class FileSystemf - the file name to openpermission - file permissionoverwrite - 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.blockSize - block sizeprogress - the progress reporterjava.io.IOException - IO failureFileSystem.setPermission(Path, FsPermission)public FSDataOutputStream createNonRecursive(Path f, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws java.io.IOException
FileSystemcreateNonRecursive in class 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.blockSize - block sizeprogress - the progress reporterjava.io.IOException - IO failureFileSystem.setPermission(Path, FsPermission)public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws java.io.IOException
FileSystemappend in class 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.java.io.IOException - IO failurepublic void close()
throws java.io.IOException
FileSystemFileSystem.deleteOnExit(Path), and remove this FS instance
from the cache, if cached.
After this operation, the outcome of any method call on this FileSystem
instance, or any input/output stream created by it is undefined.close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in class FileSystemjava.io.IOException - IO failurepublic boolean setReplication(Path src, short replication) throws java.io.IOException
setReplication in class FileSystemsrc - file namereplication - new replicationjava.io.IOException - an IO failure.public boolean rename(Path src, Path dst) throws java.io.IOException
FileSystemrename in class FileSystemsrc - path to be renameddst - new path after renamejava.io.IOException - on failurepublic FSDataOutputStream append(Path f) throws java.io.IOException
FileSystemappend(f, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY,
IO_FILE_BUFFER_SIZE_DEFAULT), null)append in class FileSystemf - the existing file to be appended.java.io.IOException - IO failurepublic boolean truncate(Path f, long newLength) throws java.io.IOException
truncate in class FileSystemf - The path to the file to be truncatednewLength - The size the file is to be truncated totrue if the file has been truncated to the desired
newLength and is immediately available to be reused for
write operations such as append, or
false if a background process of adjusting the length of
the last block has been started, and clients should wait for it to
complete before proceeding with further file updates.java.io.IOException - IO failurepublic boolean delete(Path f, boolean recursive) throws java.io.IOException
delete in class 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.java.io.IOException - IO failurepublic FileStatus[] listStatus(Path f) throws java.io.IOException
listStatus in class FileSystemf - given pathjava.io.FileNotFoundException - when the path does not existjava.io.IOException - see specific implementationpublic Path getHomeDirectory()
getHomeDirectory in class FileSystempublic void setWorkingDirectory(Path newDir)
FileSystemsetWorkingDirectory in class FileSystemnewDir - Path of new working directorypublic boolean mkdirs(Path f, FsPermission permission) throws java.io.IOException
mkdirs in class FileSystemf - path to createpermission - to apply to fjava.io.IOException - IO failurepublic void copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path src,
Path dst)
throws java.io.IOException
copyFromLocalFile in class FileSystemdelSrc - whether to delete the srcoverwrite - whether to overwrite an existing filesrc - pathdst - pathjava.io.IOException - IO failurepublic void copyFromLocalFile(boolean delSrc,
boolean overwrite,
Path[] srcs,
Path dst)
throws java.io.IOException
FileSystemcopyFromLocalFile in class FileSystemdelSrc - whether to delete the srcoverwrite - whether to overwrite an existing filesrcs - array of paths which are sourcedst - pathjava.io.IOException - IO failurepublic void copyToLocalFile(boolean delSrc,
Path src,
Path dst)
throws java.io.IOException
copyToLocalFile in class FileSystemdelSrc - whether to delete the srcsrc - path src file in the remote filesystemdst - path local destinationjava.io.IOException - IO failurepublic Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws java.io.IOException
startLocalOutput in class FileSystemfsOutputFile - path of output filetmpLocalFile - path of local tmp filejava.io.IOException - IO failurepublic void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws java.io.IOException
completeLocalOutput in class FileSystemfsOutputFile - path of output filetmpLocalFile - path to local tmp filejava.io.IOException - IO failurepublic void setOwner(Path p, java.lang.String username, java.lang.String groupname) throws java.io.IOException
setOwner in class FileSystemp - The pathusername - If it is null, the original username remains unchanged.groupname - If it is null, the original groupname remains unchanged.java.io.IOException - IO failurepublic void setTimes(Path p, long mtime, long atime) throws java.io.IOException
FileSystemsetTimes in class 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.java.io.IOException - IO failurepublic void setPermission(Path p, FsPermission permission) throws java.io.IOException
setPermission in class FileSystemp - The pathpermission - permissionjava.io.IOException - IO failurepublic boolean hasPathCapability(Path path, java.lang.String capability) throws java.io.IOException
true, this instance is explicitly
declaring that the capability is available.
If the function returns false, it can mean one of:
Implementors: PathCapabilitiesSupport
can be used to help implement this method.
hasPathCapability in interface PathCapabilitieshasPathCapability in class FileSystempath - path to query the capability of.capability - non-null, non-empty string to query the path for support.java.io.IOException - this should not be raised, except on problems
resolving paths or relaying the call.public FsServerDefaults getServerDefaults() throws java.io.IOException
FileSystemgetServerDefaults in class FileSystemjava.io.IOException - IO failurepublic FsServerDefaults getServerDefaults(Path f) throws java.io.IOException
FileSystemgetServerDefaults in class FileSystemf - path is used to identify an FS since an FS could have
another FS that it could be delegating the call tojava.io.IOException - IO failurepublic long getUsed()
throws java.io.IOException
FileSystemgetUsed in class FileSystemjava.io.IOException - IO failurepublic long getUsed(Path path) throws java.io.IOException
getUsed in class FileSystempath - the path.java.io.IOException - IO failurepublic long getDefaultBlockSize()
FileSystemgetDefaultBlockSize in class FileSystempublic long getDefaultBlockSize(Path f)
FileSystemgetDefaultBlockSize in class FileSystemf - path of filepublic short getDefaultReplication()
FileSystemgetDefaultReplication in class FileSystempublic short getDefaultReplication(Path f)
FileSystemgetDefaultReplication in class FileSystemf - of the filepublic FSDataOutputStreamBuilder createFile(Path path)
FileSystemcreateFile in class FileSystempath - file pathpublic FSDataOutputStreamBuilder appendFile(Path path)
FileSystemappendFile in class FileSystempath - file path.FSDataOutputStreamBuilder to build file append request.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.