public class SecureIOUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SecureIOUtils.AlreadyExistsException
Signals that an attempt to create a file at a given pathname has failed
because another file already existed at that path.
|
Constructor and Description |
---|
SecureIOUtils() |
Modifier and Type | Method and Description |
---|---|
static FileOutputStream |
createForWrite(File f,
int permissions)
Open the specified File for write access, ensuring that it does not exist.
|
static FileInputStream |
openForRead(File f,
String expectedOwner,
String expectedGroup)
Open the given File for read access, verifying the expected user/group
constraints if security is enabled.
|
public SecureIOUtils()
public static FileInputStream openForRead(File f, String expectedOwner, String expectedGroup) throws IOException
f
- the file that we are trying to openexpectedOwner
- the expected user owner for the fileexpectedGroup
- the expected group owner for the fileIOException
- if an IO Error occurred, or security is enabled and
the user/group does not matchpublic static FileOutputStream createForWrite(File f, int permissions) throws IOException
f
- the file that we want to createpermissions
- we want to have on the file (if security is enabled)SecureIOUtils.AlreadyExistsException
- if the file already existsIOException
- if any other error occurredCopyright © 2014 Apache Software Foundation. All Rights Reserved.