Class ManagedFileAccess
- java.lang.Object
-
- org.hl7.fhir.utilities.filesystem.ManagedFileAccess
-
public class ManagedFileAccess extends Object
see security.md - manages access to the local file system by the FHIR HAPI Core library By using accessPolicy, allowedPaths and accessor, a host java application can control whether this library has direct access to the file system (and which paths it is allowed to access), or whether the host application provides controlled access, or whether no access is allowed at all (in which case other information providers need to be provided)- Author:
- Grahame
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classManagedFileAccess.FileAccessPolicystatic interfaceManagedFileAccess.IFileAccessor
-
Constructor Summary
Constructors Constructor Description ManagedFileAccess()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CSFilecsfile(String pathname)same as file() but checks case is correct when opening directly (for consistency across platforms)static Filefile(String pathname)Open a file, conforming to local security policystatic Filefile(String path, String filepath)static FilefromPath(Path path)static ManagedFileAccess.FileAccessPolicygetAccessPolicy()static FileInputStreaminStream(File file)This doesn't do anything, but it's useful for it to exist, to make code inspection easierstatic FileInputStreaminStream(String pathname)Open a FileInputStream, conforming to local security policystatic File[]listFiles(File f)static FileOutputStreamoutStream(File file)This doesn't do anything, but it's useful for it to exist, to make code inspection easierstatic FileOutputStreamoutStream(String pathname)Open a FileInputStream, conforming to local security policystatic voidsetAccessPolicy(ManagedFileAccess.FileAccessPolicy accessPolicy)
-
-
-
Constructor Detail
-
ManagedFileAccess
public ManagedFileAccess()
-
-
Method Detail
-
getAccessPolicy
public static ManagedFileAccess.FileAccessPolicy getAccessPolicy()
-
setAccessPolicy
public static void setAccessPolicy(ManagedFileAccess.FileAccessPolicy accessPolicy)
-
file
public static File file(String pathname) throws IOException
Open a file, conforming to local security policy- Throws:
IOException
-
file
public static File file(String path, String filepath) throws IOException
- Throws:
IOException
-
inStream
public static FileInputStream inStream(String pathname) throws IOException
Open a FileInputStream, conforming to local security policy- Throws:
IOException
-
inStream
public static FileInputStream inStream(File file) throws FileNotFoundException
This doesn't do anything, but it's useful for it to exist, to make code inspection easier- Parameters:
file-- Returns:
- Throws:
FileNotFoundException
-
outStream
public static FileOutputStream outStream(String pathname) throws IOException
Open a FileInputStream, conforming to local security policy- Throws:
IOException
-
outStream
public static FileOutputStream outStream(File file) throws FileNotFoundException
This doesn't do anything, but it's useful for it to exist, to make code inspection easier- Parameters:
file-- Returns:
- Throws:
FileNotFoundException
-
csfile
public static CSFile csfile(String pathname) throws IOException
same as file() but checks case is correct when opening directly (for consistency across platforms)- Throws:
IOException
-
fromPath
public static File fromPath(Path path) throws IOException
- Throws:
IOException
-
listFiles
public static File[] listFiles(File f) throws IOException
- Throws:
IOException
-
-