public class HarFileSystem extends FilterFileSystem
FileSystem.Statistics
Modifier and Type | Field and Description |
---|---|
static int |
METADATA_CACHE_ENTRIES_DEFAULT |
static String |
METADATA_CACHE_ENTRIES_KEY |
static int |
VERSION |
fs, swapScheme
DEFAULT_FILTER, DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics
Constructor and Description |
---|
HarFileSystem()
public construction of harfilesystem
|
HarFileSystem(FileSystem fs)
Constructor to create a HarFileSystem with an
underlying filesystem.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
No more filesystem operations are needed.
|
void |
completeLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
not implemented.
|
void |
copyFromLocalFile(boolean delSrc,
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.
|
boolean |
delete(Path f,
boolean recursive)
Not implemented.
|
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)
Get the checksum of a file.
|
FileStatus |
getFileStatus(Path f)
return the filestatus of files in har archive.
|
static int |
getHarHash(Path p)
the hash of the path p inside iniside
the filesystem
|
int |
getHarVersion() |
Path |
getHomeDirectory()
return the top level archive path.
|
URI |
getUri()
Returns the uri of this filesystem.
|
Path |
getWorkingDirectory()
return the top level archive.
|
void |
initialize(URI name,
Configuration conf)
Initialize a Har filesystem per har archive.
|
RemoteIterator<LocatedFileStatus> |
listLocatedStatus(Path f)
List files and its block locations in a directory.
|
FileStatus[] |
listStatus(Path f)
liststatus returns the children of a directory
after looking up the index files.
|
Path |
makeQualified(Path path)
Make sure that a path specifies a FileSystem.
|
boolean |
mkdirs(Path f,
FsPermission permission)
not implemented.
|
FSDataInputStream |
open(Path f,
int bufferSize)
Returns a har input stream which fakes end of
file.
|
void |
setOwner(Path p,
String username,
String groupname)
not implemented.
|
void |
setPermission(Path p,
FsPermission permisssion)
Not implemented.
|
boolean |
setReplication(Path src,
short replication)
Not implemented.
|
void |
setWorkingDirectory(Path newDir)
Set the current working directory for the given file system.
|
Path |
startLocalOutput(Path fsOutputFile,
Path tmpLocalFile)
not implemented.
|
append, checkPath, copyFromLocalFile, copyFromLocalFile, getCanonicalUri, getChildFileSystems, getConf, getContentSummary, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getInitialWorkingDirectory, getRawFileSystem, getServerDefaults, getServerDefaults, getStatus, getUsed, listCorruptFileBlocks, primitiveCreate, primitiveMkdir, rename, resolvePath, setTimes, setVerifyChecksum, setWriteChecksum
append, append, cancelDeleteOnExit, clearStatistics, closeAll, closeAllForUGI, copyFromLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, createNewFile, createNonRecursive, createNonRecursive, delete, deleteOnExit, exists, get, get, get, getAllStatistics, getBlockSize, getDefaultPort, getDefaultUri, getFileBlockLocations, getLength, getLocal, getName, getNamed, getReplication, getStatistics, getStatistics, getStatus, globStatus, globStatus, isDirectory, isFile, listFiles, listLocatedStatus, listStatus, listStatus, listStatus, mkdirs, mkdirs, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, newInstance, newInstance, newInstance, newInstanceLocal, open, primitiveMkdir, printStatistics, processDeleteOnExit, rename, setDefaultUri, setDefaultUri
setConf
public static final 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
- public void initialize(URI name, Configuration conf) throws IOException
initialize
in class FilterFileSystem
name
- a uri whose authority section names the host, port, etc.
for this FileSystemconf
- the configurationIOException
public int getHarVersion() throws IOException
IOException
public Path getWorkingDirectory()
getWorkingDirectory
in class FilterFileSystem
public URI getUri()
getUri
in class FilterFileSystem
public Path makeQualified(Path path)
FilterFileSystem
makeQualified
in class FilterFileSystem
path
- to usepublic BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException
getFileBlockLocations
in class FilterFileSystem
file
- the input filestatus to get block locationsstart
- the start of the desired range in the contained filelen
- the length of the desired rangeIOException
public static int getHarHash(Path p)
p
- the path in the harfilesystempublic FileStatus getFileStatus(Path f) throws IOException
getFileStatus
in class FilterFileSystem
f
- the path in har filesystemIOException
FileNotFoundException
- when the path does not exist;
IOException see specific implementationpublic FileChecksum getFileChecksum(Path f)
FilterFileSystem
getFileChecksum
in class FilterFileSystem
f
- The file pathpublic FSDataInputStream open(Path f, int bufferSize) throws IOException
open
in class FilterFileSystem
f
- the file name to openbufferSize
- the size of the buffer to be used.IOException
public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException
FilterFileSystem
create
in class FilterFileSystem
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 void close() throws IOException
FileSystem
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterFileSystem
IOException
public boolean setReplication(Path src, short replication) throws IOException
setReplication
in class FilterFileSystem
src
- file namereplication
- new replicationIOException
public boolean delete(Path f, boolean recursive) throws IOException
delete
in class FilterFileSystem
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 RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException
FilterFileSystem
listLocatedStatus
in class FilterFileSystem
f
- is the pathFileNotFoundException
- If f
does not existIOException
- If an I/O error occurredpublic FileStatus[] listStatus(Path f) throws IOException
listStatus
in class FilterFileSystem
f
- given pathFileNotFoundException
- when the path does not exist;
IOException see specific implementationIOException
public Path getHomeDirectory()
getHomeDirectory
in class FilterFileSystem
public void setWorkingDirectory(Path newDir)
FilterFileSystem
setWorkingDirectory
in class FilterFileSystem
public boolean mkdirs(Path f, FsPermission permission) throws IOException
mkdirs
in class FilterFileSystem
f
- path to createpermission
- to apply to fIOException
public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException
copyFromLocalFile
in class FilterFileSystem
delSrc
- whether to delete the srcsrc
- pathdst
- pathIOException
public void copyToLocalFile(boolean delSrc, Path src, Path dst) throws IOException
copyToLocalFile
in class FilterFileSystem
delSrc
- whether to delete the srcsrc
- pathdst
- pathIOException
public Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
startLocalOutput
in class FilterFileSystem
fsOutputFile
- path of output filetmpLocalFile
- path of local tmp fileIOException
public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException
completeLocalOutput
in class FilterFileSystem
fsOutputFile
- path of output filetmpLocalFile
- path to local tmp fileIOException
public void setOwner(Path p, String username, String groupname) throws IOException
setOwner
in class FilterFileSystem
p
- The pathusername
- If it is null, the original username remains unchanged.groupname
- If it is null, the original groupname remains unchanged.IOException
public void setPermission(Path p, FsPermission permisssion) throws IOException
setPermission
in class FilterFileSystem
IOException
Copyright © 2013 Apache Software Foundation. All Rights Reserved.