Class LocalFileStorage
-
- All Implemented Interfaces:
-
org.ossreviewtoolkit.utils.ort.storage.FileStorage
public class LocalFileStorage implements FileStorage
A FileStorage that stores files in a directory of the local file system. The read and write operations are Synchronized.
-
-
Constructor Summary
Constructors Constructor Description LocalFileStorage(File directory)
-
Method Summary
Modifier and Type Method Description final FilegetDirectory()The directory used to store files in. StringtransformPath(String path)Return the internally used path, which might differ from the provided path e.g. Booleanexists(String path)Return whether the given path exists or not. InputStreamread(String path)Read the file at path. Unitwrite(String path, InputStream inputStream)Write the data from inputStream to the file at path. Booleandelete(String path)Delete the file at the given path and return whether the operation was successful. -
-
Constructor Detail
-
LocalFileStorage
LocalFileStorage(File directory)
-
-
Method Detail
-
getDirectory
final File getDirectory()
The directory used to store files in.
-
transformPath
String transformPath(String path)
Return the internally used path, which might differ from the provided path e.g. in case a suffix is added to denote a compression scheme.
-
read
@Synchronized() InputStream read(String path)
Read the file at path. It is the caller's responsibility to close the returned InputStream after consuming it.
-
write
@Synchronized() Unit write(String path, InputStream inputStream)
Write the data from inputStream to the file at path. If the file already exists it is overwritten. The provided inputStream is closed after writing it to the file.
-
delete
@Synchronized() Boolean delete(String path)
Delete the file at the given path and return whether the operation was successful.
-
-
-
-