Package tv.hd3g.transfertfiles
Interface AbstractFile
- All Known Implementing Classes:
CommonAbstractFile,FTPFile,LocalFile,SFTPFile
public interface AbstractFile
Expected to be stateless (store statuses in corresponding AbstractFileSystem) and thread safe.
Don't forget to implements hashCode, equals and toString.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckIsSameFileSystem(AbstractFile from, AbstractFile destination) default voidcopyAbstractToAbstract(AbstractFile destination, int bufferSize, DataExchangeObserver dataExchangeObserver, DataExchangeInOutStream exchange) default DataExchangeInOutStreamcopyAbstractToAbstract(AbstractFile destination, DataExchangeObserver dataExchangeObserver, DataExchangeFilter... filters) voidcopyAbstractToLocal(File localFile, TransfertObserver observer) voiddelete()Not recursive.longdownloadAbstract(OutputStream outputStream, int bufferSize, SizedStoppableCopyCallback copyCallback) Only use with a regular file.booleanexists()getName()getPath()Relative path onlybooleanbooleanisFile()booleanisHidden()booleanisLink()booleanlonglonglength()list()voidmkdir()static StringnormalizePath(String path) default AbstractFilevoidsendLocalToAbstract(File localFile, TransfertObserver observer) default CachedFileAttributestoCache()default Stream<CachedFileAttributes>longuploadAbstract(InputStream inputStream, int bufferSize, SizedStoppableCopyCallback copyCallback) Only use with a regular file.
-
Method Details
-
getFileSystem
AbstractFileSystem<?> getFileSystem() -
copyAbstractToLocal
-
sendLocalToAbstract
-
getPath
String getPath()Relative path only- Returns:
- always with '/' as directory separators
-
getName
String getName() -
getParent
AbstractFile getParent()- Returns:
- null if not parent (this is root dir)
-
length
long length() -
exists
boolean exists() -
delete
void delete()Not recursive. -
isDirectory
boolean isDirectory() -
isFile
boolean isFile() -
isLink
boolean isLink() -
isSpecial
boolean isSpecial() -
isHidden
boolean isHidden()- Returns:
- marked "hidden" or is a dotfile
-
lastModified
long lastModified() -
list
Stream<AbstractFile> list() -
mkdir
void mkdir() -
renameTo
- Returns:
- moved file
-
renameTo
- Returns:
- moved file
-
toCache
- Returns:
- a read-only cached data version of this AbstractFile
-
toCachedList
- Returns:
- a read-only cached list data version of AbstractFile.list
-
normalizePath
-
downloadAbstract
long downloadAbstract(OutputStream outputStream, int bufferSize, SizedStoppableCopyCallback copyCallback) Only use with a regular file. Type will not be checked before copy action. Never forget to call outputStream.close after download.- Parameters:
bufferSize- can be used on internal stream transfert, but it's not mandated.- Returns:
- data size readed from this
-
uploadAbstract
long uploadAbstract(InputStream inputStream, int bufferSize, SizedStoppableCopyCallback copyCallback) Only use with a regular file. Type will not be checked before copy action.- Parameters:
bufferSize- can be used on internal stream transfert, but it's not mandated.- Returns:
- data size writer to this
-
checkIsSameFileSystem
-
copyAbstractToAbstract
default DataExchangeInOutStream copyAbstractToAbstract(AbstractFile destination, DataExchangeObserver dataExchangeObserver, DataExchangeFilter... filters) -
copyAbstractToAbstract
default void copyAbstractToAbstract(AbstractFile destination, int bufferSize, DataExchangeObserver dataExchangeObserver, DataExchangeInOutStream exchange)
-