public class SecureAction extends Object
Modifier and Type | Method and Description |
---|---|
static PrivilegedAction<SecureAction> |
createSecureAction()
Creates a privileged action that can be used to construct a SecureAction object.
|
Thread |
createThread(Runnable target,
String name,
ClassLoader contextLoader)
Creates a new Thread from a Runnable.
|
boolean |
exists(File file)
Returns true if a file exists, otherwise false is returned.
|
Class<?> |
forName(String name)
Returns a Class.
|
File |
getAbsoluteFile(File file)
Returns the absolute file.
|
File |
getCanonicalFile(File file)
Returns the canonical file.
|
String |
getCanonicalPath(File file)
Returns the canonical path of a file.
|
FileInputStream |
getFileInputStream(File file)
Creates a FileInputStream from a File.
|
FileOutputStream |
getFileOutputStream(File file,
boolean append)
Creates a FileInputStream from a File.
|
Properties |
getProperties()
Returns the system properties.
|
String |
getProperty(String property)
Returns a system property.
|
String |
getProperty(String property,
String def)
Returns a system property.
|
<S> S |
getService(ServiceReference<S> reference,
BundleContext context)
Gets a service object.
|
URL |
getURL(String protocol,
String host,
int port,
String file,
URLStreamHandler handler)
Gets a URL.
|
ZipFile |
getZipFile(File file)
Returns a ZipFile.
|
boolean |
isDirectory(File file)
Returns true if a file is a directory, otherwise false is returned.
|
long |
lastModified(File file)
Returns a file's last modified stamp.
|
long |
length(File file)
Returns the length of a file.
|
String[] |
list(File file)
Returns a file's list.
|
Class<?> |
loadSystemClass(String name)
Returns a Class.
|
void |
open(ServiceTracker<?,?> tracker)
Opens a ServiceTracker.
|
void |
start(Bundle bundle)
Starts a bundle
|
void |
start(Bundle bundle,
int options)
Starts a bundle.
|
public static PrivilegedAction<SecureAction> createSecureAction()
SecureAction secureAction = (SecureAction) AccessController.doPrivileged(SecureAction.createSecureAction());
public String getProperty(String property)
property
- the property key.public String getProperty(String property, String def)
property
- the property key.def
- the default value if the property key does not exist.public Properties getProperties()
public FileInputStream getFileInputStream(File file) throws FileNotFoundException
file
- the File to craete a FileInputStream from.FileNotFoundException
- if the File does not exist.public FileOutputStream getFileOutputStream(File file, boolean append) throws FileNotFoundException
file
- the File to create a FileOutputStream from.append
- indicates if the OutputStream should append content.FileNotFoundException
- if the File does not exist.public long length(File file)
file
- a file objectpublic String getCanonicalPath(File file) throws IOException
file
- a file objectIOException
- on errorpublic File getAbsoluteFile(File file)
file
- a file objectpublic File getCanonicalFile(File file) throws IOException
file
- a file objectIOException
public boolean exists(File file)
file
- a file objectpublic boolean isDirectory(File file)
file
- a file objectpublic long lastModified(File file)
file
- a file objectpublic String[] list(File file)
file
- a file objectpublic ZipFile getZipFile(File file) throws IOException
file
- the file to get a ZipFile forIOException
- if an error occuredpublic URL getURL(String protocol, String host, int port, String file, URLStreamHandler handler) throws MalformedURLException
URL.URL(java.lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler)
protocol
- the protocolhost
- the hostport
- the portfile
- the filehandler
- the URLStreamHandlerMalformedURLException
public Thread createThread(Runnable target, String name, ClassLoader contextLoader)
target
- the Runnable to create the Thread from.name
- The name of the Thread.contextLoader
- the context class loader for the threadpublic <S> S getService(ServiceReference<S> reference, BundleContext context)
reference
- the ServiceReferencecontext
- the BundleContextpublic Class<?> forName(String name) throws ClassNotFoundException
name
- the name of the class.ClassNotFoundException
public Class<?> loadSystemClass(String name) throws ClassNotFoundException
name
- the name of the class.ClassNotFoundException
public void open(ServiceTracker<?,?> tracker)
tracker
- the ServiceTracker to open.public void start(Bundle bundle, int options) throws BundleException
bundle
- the bundle to startoptions
- the start optionsBundleException
public void start(Bundle bundle) throws BundleException
bundle
- BundleException
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.