The information in this article applies to:
This article describes how to access scratch space on a client machine from a Java applet. Scratch space requires features of Microsoft® Internet Explorer (IE) and the Microsoft® virtual machine (Microsoft VM). These features are available in Internet Explorer 4.0 and the Microsoft VM that includes Build 2252 or later.
Scratch space is storage on the client machine that an applet can safely access without needing full access to the client file system. Scratch space is managed by the Microsoft VM a to ensure that it cannot be abused by malicious applets.
The following is true of scratch space:
Follow these steps to use scratch space in your applet:
import com.ms.io.clientstorage.*;
ClientStore m_store;
m_store = ClientStorageManager.getStore();
OutputStream o = m_store.openWritable(m_filename); InputStream o = m_store.openReadable(m_filename);
cabarc N MyApplet.cab MyApplet.class
SignCode ... -j JavaSign.dll -jp Medium ... MyApplet.cab
You can also open an output file where new data is appended onto the existing file. To do so, call the following:
ClientStore.OpenWritable(String filename, boolean append) throws IOException;
If append is true, new data will be appended. Otherwise, the file will be truncated if it already exists. In either case, the file is created if it does not already exist.
If all you need to do is open a file for input or output, you can do so without having to declare a ClientStore variable. Simply call one of the following three functions directly. These three functions maintain the store internally. Each function throws an IOException in the case of an error.
InputStream ClientStorageManager.OpenReadable(String filename); OutputStream ClientStorageManager.OpenWritable(String filename); OutputStream ClientStorageManager.OpenWritable(String filename, boolean append);
The following code fragment opens a scratch space file called "Demo.txt" on the client machine, and appends a string to the file:
m_store = ClientStorageManager.getStore(); OutputStream os = m_store.openWritable("demo.txt", true); os.write("This is stored in scratch space");
More information on the clientstorage package is available in the following location:
For additional information on making your Java Code trusted in Microsoft Internet Explorer, please refer to the following Knowledge Base article:
Q193877 HOWTO: Making your Java Code Trusted in Internet Explorer
For the latest Knowledge Base articles and other support information on Microsoft® Visual J++® and the SDK for Java, please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/