|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.lightdev.lib.filesystem.LocalFileSystem
public class LocalFileSystem
This class implements interface FileSystem for the file system of the
machine this class is instantiated on. The implementation relies on the standard
Java class java.io.File and wraps its methods into the methods required by
interface FileSystem as required and where possible. In addition it implements
methods not supported by class java.io.File such as copy, move, etc.
FileSystem,
File| Field Summary |
|---|
| Fields inherited from interface com.lightdev.lib.filesystem.FileSystem |
|---|
LOCAL_FILE_SYSTEM |
| Constructor Summary | |
|---|---|
LocalFileSystem()
create a new instance of class LocalFileSystem |
|
| Method Summary | |
|---|---|
void |
copy(FileRef[] filesToCopy,
FileRef toFolder)
copy files to a given folder. |
void |
createFolder(FileRef folder)
create a new folder |
void |
delete(FileRef[] filesToDelete)
delete one or more files |
void |
extract(FileRef archive,
FileRef toFolder)
extract a given ZIP archive to a given folder |
boolean |
fileExists(FileRef file)
determine whether or not a given file exists in this instance of file system |
String |
getFileSeparator()
get the string that is used to separate file and folder names in path expressions for the machine this file system refers to |
long |
getFolderSize(FileRef folder)
determine the size of a folder in bytes |
FileRef |
getParentFile(FileRef file)
get the file that is directly on top of a given file in the file hierarchy of this file system |
FileRef[] |
getRoots()
get the root directories of this file system |
String |
getUrl()
get the url string of the machine this file system is located |
FileRef[] |
list(FileRef folder)
get the files that are contained in a given folder |
void |
move(FileRef[] filesToMove,
FileRef toFolder)
move one or more files to a given folder. |
void |
pack(FileRef folder,
FileRef archive)
pack the contents of a given folder into a new ZIP compressed archive |
byte[] |
read(FileRef file)
read contents of a file to a byte array in memory |
void |
rename(FileRef file,
String newName)
rename a file, i.e. change the name of a file but not its location |
void |
write(FileRef file,
byte[] contents)
write contents of a file from a byte array in memory |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LocalFileSystem()
LocalFileSystem
| Method Detail |
|---|
public FileRef[] list(FileRef folder)
list in interface FileSystemfolder - the directory to get the files for
Exceptionpublic FileRef getParentFile(FileRef file)
getParentFile in interface FileSystemfile - the file to get the parent file for
Exceptionpublic FileRef[] getRoots()
getRoots in interface FileSystemExceptionpublic String getFileSeparator()
getFileSeparator in interface FileSystemException
public void copy(FileRef[] filesToCopy,
FileRef toFolder)
throws Exception
copy in interface FileSystemfilesToCopy - the files to copytoFolder - the directory to copy to
Exception
public void rename(FileRef file,
String newName)
throws Exception
rename in interface FileSystemfile - the file to renamenewName - the new name; just the name, no path
Exception
public void move(FileRef[] filesToMove,
FileRef toFolder)
throws Exception
move in interface FileSystemfilesToMove - the the files to movetoFolder - the folder to move to
Exception
public void delete(FileRef[] filesToDelete)
throws Exception
delete in interface FileSystemfilesToDelete - the list of files to delete
Exception
public void extract(FileRef archive,
FileRef toFolder)
throws Exception
extract in interface FileSystemarchive - the archive to extracttoFolder - the folder to extract the contents of the archive to
Exception
public void pack(FileRef folder,
FileRef archive)
throws Exception
pack in interface FileSystemfolder - the folder to packarchive - the archive to create from the given files
Exception
public void createFolder(FileRef folder)
throws Exception
createFolder in interface FileSystemfolder - the folder to create
Exception
public boolean fileExists(FileRef file)
throws Exception
fileExists in interface FileSystemfile - the file to determine existence for
Exception
public long getFolderSize(FileRef folder)
throws Exception
getFolderSize in interface FileSystemfolder - the folder to determine the size for
Exception
public String getUrl()
throws Exception
getUrl in interface FileSystemException
public byte[] read(FileRef file)
throws Exception
read in interface FileSystemfile - reference to the file to read
Exception
public void write(FileRef file,
byte[] contents)
throws Exception
write in interface FileSystemfile - reference to the file to writecontents - the contents to write to the referenced file
Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||