Module java.jnlp
Package javax.jnlp

Interface FileSaveService


  • public interface FileSaveService
    FileSaveService service allows the user to save a file to the local file system, even for applications that are running in the untrusted execution environment. The JNLP Client is the mediator and is therefore responsible for providing the specific implementation of this, if any.

    This service provides similar functionatlity as the Save as... functionality provided by most browsers.

    Since:
    1.4.2
    See Also:
    FileOpenService, FileContents
    • Method Detail

      • saveFileDialog

        FileContents saveFileDialog​(String pathHint,
                                    String[] extensions,
                                    InputStream stream,
                                    String name)
                             throws IOException
        Asks the users to save a file.
        Parameters:
        pathHint - A hint from the application to the default directory to be used. This might be ignored by the JNLP Client.
        extensions - A list of default extensions to show in the file chooser. For example, String[] { "txt", "java" }. These might be ignored by the JNLP Client.
        stream - The content of the file to save along represented as an InputStream
        name - The suggested filename, which might be ignored by the JNLP client
        Returns:
        A FileContents object for the saved file if the save was successfully, or null if the user canceled the request.
        Throws:
        IOException - if the requested failed in any way other than the user chose not to save the file
      • saveAsFileDialog

        FileContents saveAsFileDialog​(String pathHint,
                                      String[] extensions,
                                      FileContents contents)
                               throws IOException
        Asks the users to save a file.
        Parameters:
        pathHint - A hint from the application to the default directory to be used. This might be ignored by the JNLP Client.
        extensions - A list of default extensions to show in the file chooser. For example, String[] { "txt", "java" }. These might be ignored by the JNLP Client.
        contents - The content of the file to save along with the suggested filename. The suggested filename might be ignored by the JNLP Client.
        Returns:
        A FileContents object for the saved file if the save was successfully, or null if the user canceled the request.
        Throws:
        IOException - if the requested failed in any way other than the user chose not to save the file