KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jnlp > FileSaveService


1 /*
2  * @(#)FileSaveService.java 1.17 04/03/12
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.jnlp;
9 import java.io.IOException;
10 import java.io.InputStream;
11
12 /**
13  * <code>FileSaveService</code> service allows the user to save a file
14  * to the local file system, even for applications that
15  * are running in the untrusted execution environment. The JNLP Client is the mediator
16  * and is therefore responsible for providing the specific implementation
17  * of this, if any.
18  * <p>
19  * This service provides similar functionatlity as the <i>Save as...</i>
20  * functionality provided by most browsers.
21  *
22  * @since 1.0
23  *
24  * @see FileOpenService
25  * @see FileContents
26  */

27 public interface FileSaveService {
28     
29     /** Asks the users to save a file.
30      *
31      * @param pathHint A hint from the application to the default directory to be
32      * used. This might be ignored by the JNLP Client.
33      *
34      * @param extensions A list of default extensions to show in the file chooser.
35      * For example, <code>String[] { "txt", "java" }</code>.
36      * These might be ignored by the JNLP Client.
37      *
38      * @param stream The content of the file to save along represented as an
39      * <code>InputStream</code>
40      *
41      * @param name The suggested filename, which might be ignored by the JNLP client
42      *
43      * @return A <code>FileContents</code> object for the saved file if the save was successfully, or
44      * <code>null</code> if the user canceled the request.
45      *
46      * @exception <code>IOException</code> if the requested failed in any way other than the user chose
47      * not to save the file
48      */

49     public FileContents saveFileDialog(String pathHint, String[] extensions, InputStream stream, String name) throws IOException;
50
51     /** Asks the users to save a file.
52      *
53      * @param pathHint A hint from the application to the default directory to be
54      * used. This might be ignored by the JNLP Client.
55      *
56      * @param extensions A list of default extensions to show in the file chooser.
57      * For example, <code>String[] { "txt", "java" }</code>.
58      * These might be ignored by the JNLP Client.
59      *
60      * @param contents The content of the file to save along with the suggested filename.
61      * The suggested filename might be ignored by the JNLP Client.
62      *
63      *
64      *
65      * @return A <code>FileContents</code> object for the saved file if the save was successfully, or
66      * <code>null</code> if the user canceled the request.
67      *
68      * @exception <code>IOException</code> if the requested failed in any way other than the user chose
69      * not to save the file
70      */

71     public FileContents saveAsFileDialog(String pathHint, String[] extensions, FileContents contents) throws IOException;
72 }
73
74
Popular Tags