Class EcmStorage
- java.lang.Object
-
- org.palladiosimulator.protocom.framework.java.ee.storage.EcmStorage
-
-
Constructor Summary
Constructors Constructor Description EcmStorage()
Constructs a new EcmStorage object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createFolder(String path)
Creates a folder.void
deleteFile(String path)
Deletes the specified file or folder.boolean
fileExists(String path)
Checks whether the specified path points to an existing file or folder.Set<String>
getFiles(String path)
Gets the files and folders contained in the specified folder.boolean
isFolder(String path)
Checks whether the specified path points to a folder.byte[]
readFile(String path)
Reads the content of the specified file.String
readFileAsString(String path)
Reads the content of the specified file.void
writeFile(String path, byte[] data)
Writes data to the specified file.void
writeFile(String path, String data)
Writes data to the specified file.
-
-
-
Method Detail
-
createFolder
public void createFolder(String path) throws IOException
Description copied from interface:IStorage
Creates a folder.- Specified by:
createFolder
in interfaceIStorage
- Parameters:
path
- the path of the new folder- Throws:
IOException
- if an error occurred while accessing the storage
-
writeFile
public void writeFile(String path, byte[] data) throws IOException
Description copied from interface:IStorage
Writes data to the specified file. The file will be overwritten if it already exists.- Specified by:
writeFile
in interfaceIStorage
- Parameters:
path
- the destination pathdata
- a byte array containing the data to write- Throws:
IOException
- if an error occurred while accessing the storage
-
writeFile
public void writeFile(String path, String data) throws IOException
Description copied from interface:IStorage
Writes data to the specified file. The file will be overwritten if it already exists.- Specified by:
writeFile
in interfaceIStorage
- Parameters:
path
- the destination pathdata
- a string containing the data to write- Throws:
IOException
- if an error occurred while accessing the storage
-
readFile
public byte[] readFile(String path) throws FileNotFoundException
Description copied from interface:IStorage
Reads the content of the specified file.- Specified by:
readFile
in interfaceIStorage
- Parameters:
path
- the path to the file whose content will be read- Returns:
- a byte array containing the file content
- Throws:
FileNotFoundException
- if the file could not be found
-
readFileAsString
public String readFileAsString(String path) throws FileNotFoundException
Description copied from interface:IStorage
Reads the content of the specified file.- Specified by:
readFileAsString
in interfaceIStorage
- Parameters:
path
- the path to the file whose content will be read- Returns:
- a string containing the file content
- Throws:
FileNotFoundException
- if the file could not be found
-
getFiles
public Set<String> getFiles(String path) throws IOException
Description copied from interface:IStorage
Gets the files and folders contained in the specified folder.- Specified by:
getFiles
in interfaceIStorage
- Parameters:
path
- the path whose files and folders will be returned- Returns:
- a set of file and folder names
- Throws:
IOException
- if an error occurred while accessing the storage
-
deleteFile
public void deleteFile(String path)
Description copied from interface:IStorage
Deletes the specified file or folder.- Specified by:
deleteFile
in interfaceIStorage
- Parameters:
path
- the file or folder to delete
-
isFolder
public boolean isFolder(String path)
Description copied from interface:IStorage
Checks whether the specified path points to a folder.
-
fileExists
public boolean fileExists(String path)
Description copied from interface:IStorage
Checks whether the specified path points to an existing file or folder.- Specified by:
fileExists
in interfaceIStorage
- Parameters:
path
- the path to check- Returns:
- true if the file or folder exists, otherwise false
-
-