HOWTO: Using Scratch Space From Your Java AppletLast reviewed: January 29, 1998Article ID: Q172200 |
The information in this article applies to:
SUMMARYThis article describes how to access scratch space on a client machine from a Java applet. Scratch space requires features of Internet Explorer (IE) and the Microsoft Virtual Machine for Java. These features are available in Internet Explorer 4.0 and the Java Virtual Machine that includes Build 2252.
MORE INFORMATION
What is Scratch Space?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 Java Virtual Machine to ensure that it cannot be abused by malicious applets. The following is true of scratch space:
How to Use Scratch Space in Your AppletFollow these steps to use scratch space in your applet:
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);Example: 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"); REFERENCESMore information on the clientstorage package, creating cabinet files, and signing cabinet files with Java privileges is available in the SDK for Java 2.0, which is available for download at http://www.microsoft.com/java/. For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/ http://support.microsoft.com/support/java/ Keywords : CmdLnUtils IOPkg JVM VJMisc Technology : internet kbInetDev Version : WINDOWS:2.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |