Package com.wavemaker.commons.io
Interface File
-
- All Superinterfaces:
Resource
- All Known Implementing Classes:
AbstractReadOnlyFile,ClassPathFile,LocalFile,StoredFile
public interface File extends Resource
A fileResourcethat may be stored on a physical disk or using some other mechanism.- See Also:
Folder,MutableFile
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FilecopyTo(Folder folder)Recursively copy this resource to the specified folder.ResourcecopyToIfNewer(Folder folder)RCopy this file to the specified folder if this file is newer than the destination.FileContentgetContent()Provides access to file content.longgetSize()Returns the size in bytes of the virtual file.FilemoveTo(Folder folder)Move this resource to the specified folder.Filerename(java.lang.String name)Rename the current resource.voidtouch()Update thelast modified timestampof the file to now.-
Methods inherited from interface com.wavemaker.commons.io.Resource
createIfMissing, delete, equals, exists, getLastModified, getName, getParent, isModifiedAfter, isModifiedAfter, isModifiedBefore, isModifiedBefore, isRelativeTo, performOperation, toString, toString, toStringRelativeTo
-
-
-
-
Method Detail
-
moveTo
File moveTo(Folder folder)
Description copied from interface:ResourceMove this resource to the specified folder. Any duplicateFiles will be replaced (existingFolderresources will be merged). If the resource does not exist aResourceDoesNotExistExceptionis thrown.
-
copyTo
File copyTo(Folder folder)
Description copied from interface:ResourceRecursively copy this resource to the specified folder. Any duplicateFiles will be replaced (existingFolderresources will be merged). If the resource does not exist aResourceDoesNotExistExceptionis thrown.
-
rename
File rename(java.lang.String name)
Description copied from interface:ResourceRename the current resource. The rename operation cannot be used not move the resource to a different folder, use theResource.moveTo(Folder)method to move the resource before renaming if required. Root folders cannot be renamed. If the resource does not exist aResourceDoesNotExistExceptionis thrown.
-
getSize
long getSize()
Returns the size in bytes of the virtual file.- Returns:
- the size in bytes
-
touch
void touch()
Update thelast modified timestampof the file to now.- Throws:
ResourceDoesNotExistException- if the resource does not exist
-
getContent
FileContent getContent()
Provides access to file content. Calling any method on a file that does notexistwill cause it to be created.- Returns:
- the file content
-
copyToIfNewer
Resource copyToIfNewer(Folder folder)
RCopy this file to the specified folder if this file is newer than the destination.- Parameters:
folder- the folder to copy the file to- Returns:
- a new resource (the current resource will no longer
exist - Throws:
ResourceDoesNotExistException- if this resource no longer exists
-
-