Interface FSFactory
-
- All Known Implementing Classes:
HDFSFactory,HybridFSFactory,LocalFSFactory,OSFSFactory
public interface FSFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcopyFile(File srcFile, File destFile)copy filevoiddeleteDirectory(String dir)Force delete the directorybooleandeleteIfExists(File file)delete the file if it existsBufferedInputStreamgetBufferedInputStream(String filePath)get input streamBufferedOutputStreamgetBufferedOutputStream(String filePath)get output streamBufferedReadergetBufferedReader(String filePath)get buffered readerBufferedWritergetBufferedWriter(String filePath, boolean append)get buffered readerFilegetFile(File parent, String child)get fileFilegetFile(String pathname)get fileFilegetFile(String parent, String child)get fileFilegetFile(URI uri)get file by uriFilegetFileWithParent(String pathname)get file with parentFile[]listFilesByPrefix(String fileFolder, String prefix)list file by prefixFile[]listFilesBySuffix(String fileFolder, String suffix)list file by suffixvoidmoveFile(File srcFile, File destFile)move file
-
-
-
Method Detail
-
getFileWithParent
File getFileWithParent(String pathname)
get file with parent- Parameters:
pathname- pathname- Returns:
- file with parent
-
getFile
File getFile(String parent, String child)
get file- Parameters:
parent- parent file pathchild- child file path- Returns:
- file
-
getFile
File getFile(File parent, String child)
get file- Parameters:
parent- parent filechild- child file path- Returns:
- file
-
getBufferedReader
BufferedReader getBufferedReader(String filePath)
get buffered reader- Parameters:
filePath- file path- Returns:
- buffered reader
-
getBufferedWriter
BufferedWriter getBufferedWriter(String filePath, boolean append)
get buffered reader- Parameters:
filePath- file pathappend- whether is append- Returns:
- buffered reader
-
getBufferedInputStream
BufferedInputStream getBufferedInputStream(String filePath)
get input stream- Parameters:
filePath- file path- Returns:
- input stream
-
getBufferedOutputStream
BufferedOutputStream getBufferedOutputStream(String filePath)
get output stream- Parameters:
filePath- file path- Returns:
- output stream
-
moveFile
void moveFile(File srcFile, File destFile) throws IOException
move file- Parameters:
srcFile- src filedestFile- dest file- Throws:
IOException
-
copyFile
void copyFile(File srcFile, File destFile) throws IOException
copy file- Parameters:
srcFile- src filedestFile- dest file- Throws:
IOException
-
listFilesBySuffix
File[] listFilesBySuffix(String fileFolder, String suffix)
list file by suffix- Parameters:
fileFolder- file foldersuffix- suffix- Returns:
- list of files
-
listFilesByPrefix
File[] listFilesByPrefix(String fileFolder, String prefix)
list file by prefix- Parameters:
fileFolder- file folderprefix- prefix- Returns:
- list of files
-
deleteIfExists
boolean deleteIfExists(File file) throws IOException
delete the file if it exists- Parameters:
file- local file or HDFS file- Throws:
IOException
-
deleteDirectory
void deleteDirectory(String dir) throws IOException
Force delete the directory- Throws:
IOException
-
-