| Modifier and Type | Method and Description |
|---|---|
void |
deleteAllFiles()
Deletes all files present under this directory
|
void |
deleteFile(String name)
Deletes a File.
|
boolean |
fileExists(String name)
Checks if a File exists in the directory
|
String |
getName() |
File |
getOrCreateFile(String name)
Creates a new, empty file or returns a reference to the named file if it already exists.
|
long |
getSizeInBytes()
Reports the total size of the directory
|
Set<String> |
listFiles()
Retrieves the names of files present in the directory
|
public File getOrCreateFile(String name) throws IOException
DirectorygetOrCreateFile in interface Directoryname - name of the File to be createdIOException - if an error occurred while processing the request.public void deleteAllFiles()
throws IOException
DirectorydeleteAllFiles in interface DirectoryIOException - if an I/O error occurspublic void deleteFile(String name) throws IOException, FileNotFoundException
DirectorydeleteFile in interface Directoryname - of the file to be deleted.IOException - if an I/O error occurs.FileNotFoundException - if the file is not found.public boolean fileExists(String name)
DirectoryfileExists in interface Directoryname - name of the file to be checked for existence.public Set<String> listFiles() throws IOException
DirectorylistFiles in interface DirectoryIOException - if an error occurs while processing the request.public long getSizeInBytes()
DirectorygetSizeInBytes in interface Directorypublic String getName()
Copyright © 2015–2024. All rights reserved.