@Experimental public class ForStFlinkFileSystem extends FileSystem
FileSystem
delegates some requests to file system loaded by Flink FileSystem mechanism.
All methods in this class maybe used by ForSt, please start a discussion firstly if it has to be modified.
FileSystem.WriteMode
Constructor and Description |
---|
ForStFlinkFileSystem(FileSystem delegateFS) |
Modifier and Type | Method and Description |
---|---|
ByteBufferWritableFSDataOutputStream |
create(Path path)
Create ByteBufferWritableFSDataOutputStream from specific path which supports to write data
to ByteBuffer with
FileSystem.WriteMode.OVERWRITE mode. |
ByteBufferWritableFSDataOutputStream |
create(Path path,
FileSystem.WriteMode overwriteMode)
Opens an FSDataOutputStream to a new file at the given path.
|
boolean |
delete(Path path,
boolean recursive)
Delete a file.
|
static FileSystem |
get(URI uri)
Returns a reference to the
FileSystem instance for accessing the file system
identified by the given URI . |
BlockLocation[] |
getFileBlockLocations(FileStatus file,
long start,
long len)
Return an array containing hostnames, offset and size of portions of the given file.
|
FileStatus |
getFileStatus(Path path)
Return a file status object that represents the path.
|
Path |
getHomeDirectory()
Returns the path of the user's home directory in this file system.
|
FileSystemKind |
getKind()
Gets a description of the characteristics of this file system.
|
URI |
getUri()
Returns a URI whose scheme and authority identify this file system.
|
Path |
getWorkingDirectory()
Returns the path of the file system's current working directory.
|
boolean |
isDistributedFS()
Returns true if this is a distributed file system.
|
FileStatus[] |
listStatus(Path path)
List the statuses of the files/directories in the given path if the path is a directory.
|
boolean |
mkdirs(Path path)
Make the given file and all non-existent parents into directories.
|
ByteBufferReadableFSDataInputStream |
open(Path path)
Opens an FSDataInputStream at the indicated Path.
|
ByteBufferReadableFSDataInputStream |
open(Path path,
int bufferSize)
Opens an FSDataInputStream at the indicated Path.
|
boolean |
rename(Path src,
Path dst)
Renames the file/directory src to dst.
|
create, create, createRecoverableWriter, exists, getDefaultBlockSize, getDefaultFsUri, getLocalFileSystem, getUnguardedFileSystem, initialize, initialize, initOutPathDistFS, initOutPathLocalFS
public ForStFlinkFileSystem(FileSystem delegateFS)
public static FileSystem get(URI uri) throws IOException
FileSystem
instance for accessing the file system
identified by the given URI
.uri
- the URI
identifying the file system.FileSystem
instance for accessing the file system
identified by the given URI
.IOException
- thrown if a reference to the file system instance could not be obtained.public ByteBufferWritableFSDataOutputStream create(Path path) throws IOException
FileSystem.WriteMode.OVERWRITE
mode.path
- The file path to write to.IOException
- Thrown, if the stream could not be opened because of an I/O, or because a
file already exists at that path and the write mode indicates to not overwrite the file.public ByteBufferWritableFSDataOutputStream create(Path path, FileSystem.WriteMode overwriteMode) throws IOException
FileSystem
If the file already exists, the behavior depends on the given WriteMode
. If the
mode is set to FileSystem.WriteMode.NO_OVERWRITE
, then this method fails with an exception.
create
in class FileSystem
path
- The file path to write tooverwriteMode
- The action to take if a file or directory already exists at the given
path.IOException
- Thrown, if the stream could not be opened because of an I/O, or because a
file already exists at that path and the write mode indicates to not overwrite the file.public ByteBufferReadableFSDataInputStream open(Path path, int bufferSize) throws IOException
FileSystem
open
in class FileSystem
path
- the file name to openbufferSize
- the size of the buffer to be used.IOException
public ByteBufferReadableFSDataInputStream open(Path path) throws IOException
FileSystem
open
in class FileSystem
path
- the file to openIOException
public boolean rename(Path src, Path dst) throws IOException
FileSystem
rename
in class FileSystem
src
- the file/directory to renamedst
- the new name of the file/directorytrue
if the renaming was successful, false
otherwiseIOException
public Path getWorkingDirectory()
FileSystem
getWorkingDirectory
in class FileSystem
public Path getHomeDirectory()
FileSystem
getHomeDirectory
in class FileSystem
public URI getUri()
FileSystem
getUri
in class FileSystem
public FileStatus getFileStatus(Path path) throws IOException
FileSystem
getFileStatus
in class FileSystem
path
- The path we want information fromFileNotFoundException
- when the path does not exist; IOException see specific
implementationIOException
public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException
FileSystem
getFileBlockLocations
in class FileSystem
IOException
public FileStatus[] listStatus(Path path) throws IOException
FileSystem
listStatus
in class FileSystem
path
- given pathIOException
public boolean delete(Path path, boolean recursive) throws IOException
FileSystem
delete
in class FileSystem
path
- the path to deleterecursive
- 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
true
if delete is successful, false
otherwiseIOException
public boolean mkdirs(Path path) throws IOException
FileSystem
mkdirs
in class FileSystem
path
- the directory/directories to be createdtrue
if at least one new directory has been created, false
otherwiseIOException
- thrown if an I/O error occurs while creating the directorypublic boolean isDistributedFS()
FileSystem
isDistributedFS
in class FileSystem
public FileSystemKind getKind()
FileSystem
getKind
in class FileSystem
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.