Package tv.hd3g.transfertfiles
Interface AbstractFile
-
- All Known Implementing Classes:
CommonAbstractFile,FTPFile,LocalFile,SFTPFile
public interface AbstractFileExpected to be stateless (store statuses in corresponding AbstractFileSystem) and thread safe. Don't forget to implements hashCode, equals and toString.
-
-
Method Summary
-
-
-
Method Detail
-
getFileSystem
AbstractFileSystem<?> getFileSystem()
-
copyAbstractToLocal
void copyAbstractToLocal(File localFile, TransfertObserver observer)
-
sendLocalToAbstract
void sendLocalToAbstract(File localFile, TransfertObserver observer)
-
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
AbstractFile renameTo(String path)
- Returns:
- moved file
-
renameTo
default AbstractFile renameTo(String path0, String... pathN)
- Returns:
- moved file
-
toCache
default CachedFileAttributes toCache()
- Returns:
- a read-only cached data version of this AbstractFile
-
toCachedList
default Stream<CachedFileAttributes> toCachedList()
- Returns:
- a read-only cached list data version of AbstractFile.list
-
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
static void checkIsSameFileSystem(AbstractFile from, AbstractFile destination)
-
copyAbstractToAbstract
default DataExchangeInOutStream copyAbstractToAbstract(AbstractFile destination, DataExchangeObserver dataExchangeObserver, DataExchangeFilter... filters)
-
copyAbstractToAbstract
default void copyAbstractToAbstract(AbstractFile destination, int bufferSize, DataExchangeObserver dataExchangeObserver, DataExchangeInOutStream exchange)
-
-