public abstract class FileSystem extends Object
Only available at job runtime.
| Constructor and Description |
|---|
FileSystem() |
| Modifier and Type | Method and Description |
|---|---|
abstract FSDataOutputStream |
append(Path f)
Append to an existing file (optional operation).
|
abstract FSDataOutputStream |
append(Path f,
int bufferSize)
Append to an existing file (optional operation).
|
FSDataOutputStream |
create(Path f)
Create an FSDataOutputStream at the indicated Path.
|
abstract FSDataOutputStream |
create(Path f,
boolean overwrite)
Create an FSDataOutputStream at the indicated Path.
|
abstract FSDataOutputStream |
create(Path f,
boolean overwrite,
int bufferSize)
Create an FSDataOutputStream at the indicated Path.
|
boolean |
createNewFile(Path f)
Creates the given Path as a brand-new zero-length file.
|
abstract boolean |
delete(Path f)
Delete a file.
|
boolean |
delete(Path f,
boolean recursive)
Non-recursive delete not supported, just for compatible with hadoop.
|
boolean |
exists(Path f)
Check if exists.
|
abstract FileStatus |
getFileStatus(Path f)
Return a file status object that represents the path.
|
boolean |
isDirectory(Path f)
True iff the named path is a directory.
|
boolean |
isFile(Path f)
True iff the named path is a regular file.
|
abstract FileStatus[] |
listStatus(Path f)
List the statuses of the files/directories in the given path if the path is
a directory.
|
FileStatus[] |
listStatus(Path[] files)
Filter files/directories in the given list of paths using default
path filter.
|
FileStatus[] |
listStatus(Path[] files,
PathFilter filter)
Filter files/directories in the given list of paths using user-supplied
path filter.
|
FileStatus[] |
listStatus(Path f,
PathFilter filter)
Filter files/directories in the given path using the user-supplied path
filter.
|
abstract boolean |
mkdirs(Path f)
Make the given file and all non-existent parents into
directories.
|
abstract FSDataInputStream |
open(Path f)
Opens an FSDataInputStream at the indicated Path.
|
abstract FSDataInputStream |
open(Path f,
int bufferSize)
Opens an FSDataInputStream at the indicated Path.
|
abstract boolean |
rename(Path src,
Path dst)
Renames Path src to Path dst.
|
public abstract FSDataInputStream open(Path f, int bufferSize) throws IOException
f - the file name to openbufferSize - the size of the buffer to be used.IOExceptionpublic abstract FSDataInputStream open(Path f) throws IOException
f - the file to openIOExceptionpublic FSDataOutputStream create(Path f) throws IOException
f - the file to createIOExceptionpublic abstract FSDataOutputStream create(Path f, boolean overwrite) throws IOException
f - the file to createoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an exception will be thrown.IOExceptionpublic abstract FSDataOutputStream create(Path f, boolean overwrite, int bufferSize) throws IOException
f - the file name to createoverwrite - 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.IOExceptionpublic boolean createNewFile(Path f) throws IOException
f - path to use for createIOExceptionpublic abstract FSDataOutputStream append(Path f) throws IOException
f - the existing file to be appended.IOExceptionpublic abstract FSDataOutputStream append(Path f, int bufferSize) throws IOException
f - the existing file to be appended.bufferSize - the size of the buffer to be used.IOExceptionpublic abstract boolean rename(Path src, Path dst) throws IOException
src - path to be renameddst - new path after renameIOException - on failurepublic abstract boolean delete(Path f) throws IOException
f - the path to delete.IOExceptionpublic boolean delete(Path f, boolean recursive) throws IOException
IOExceptionpublic boolean exists(Path f) throws IOException
f - source fileIOExceptionpublic boolean isDirectory(Path f) throws IOException
f - path to checkIOExceptionpublic boolean isFile(Path f) throws IOException
f - path to checkIOExceptionpublic abstract FileStatus[] listStatus(Path f) throws FileNotFoundException, IOException
f - given pathFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileStatus[] listStatus(Path f, PathFilter filter) throws FileNotFoundException, IOException
f - a path namefilter - the user-supplied path filterFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileStatus[] listStatus(Path[] files) throws FileNotFoundException, IOException
files - a list of pathsFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic FileStatus[] listStatus(Path[] files, PathFilter filter) throws FileNotFoundException, IOException
files - a list of pathsfilter - the user-supplied path filterFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionpublic abstract boolean mkdirs(Path f) throws IOException
f - path to createIOExceptionpublic abstract FileStatus getFileStatus(Path f) throws IOException
f - The path we want information fromFileNotFoundException - when the path does not exist;
IOException see specific implementationIOExceptionCopyright © 2021 Alibaba Cloud Computing. All rights reserved.