Package javax.jnlp

Examples of javax.jnlp.FileContents


      ps.delete(muffinURL);
    } catch (Exception e) {
      // ignore
    }
    ps.create(muffinURL, 5000);
    FileContents fc = ps.get(muffinURL);
    OutputStream os = fc.getOutputStream(false);
    return os;
  }
View Full Code Here


        ByteArrayOutputStream outXML = new ByteArrayOutputStream();
        Serializer serializer = new Serializer(outXML, "ISO-8859-1");
        serializer.write(doc);

        FileContents fc = save.saveFileDialog(null,
            new String[] { "chair" }, new ByteArrayInputStream(
                outXML.toByteArray()), null);

      } catch (Exception ex) {
        LOGGER.error("exception: " + ex);
View Full Code Here

        ByteArrayOutputStream outXML = new ByteArrayOutputStream();
        Serializer serializer = new Serializer(outXML, "ISO-8859-1");
        serializer.write(doc);

        FileContents fc = save.saveFileDialog(null,
            new String[] { "chair" }, new ByteArrayInputStream(
                outXML.toByteArray()), null);

      } catch (Exception ex) {
        LOGGER.error("exception: " + ex);
View Full Code Here

      FileSaveService save;
      try {
        save = (FileSaveService) ServiceManager
            .lookup("javax.jnlp.FileSaveService");
        GLOBAL.shapePack.build();
        FileContents fc = save.saveFileDialog(null,
            new String[] { "dxf" }, new ByteArrayInputStream(
                GLOBAL.shapePack.getDXFBuffered(GLOBAL.applet)
                    .toByteArray()), null);

      } catch (UnavailableServiceException e1) {
View Full Code Here

      FileSaveService save;
      try {
        save = (FileSaveService) ServiceManager
            .lookup("javax.jnlp.FileSaveService");
        GLOBAL.shapePack.build();
        FileContents fc = save.saveFileDialog(null,
            new String[] { "pdf" }, new ByteArrayInputStream(
                GLOBAL.shapePack.getPDFBuffered(GLOBAL.applet)
                    .toByteArray()), null);

      } catch (UnavailableServiceException e1) {
View Full Code Here

    ServiceManager.lookup("javax.jnlp.PersistenceService");

    BasicService basicService = (BasicService)
    ServiceManager.lookup("javax.jnlp.BasicService");
   
    FileContents contents = null;
    try {
      url = new URL(basicService.getCodeBase(), "configuration.xml");
      contents = persistenceService.get(url);
    } catch (MalformedURLException e1) {
      e1.printStackTrace();
    } catch (FileNotFoundException e1) {
      try {
        persistenceService.create(url,10000);
        contents = persistenceService.get(url);
      } catch (MalformedURLException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    } catch (IOException e1) {
      e1.printStackTrace();
    }
   
    try {
      properties.load(contents.getInputStream());
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

    saveProperties();
  }

  protected void saveProperties() throws IOException {
    if (usePersistenceService) {
      FileContents contents;
      try {
        contents = persistenceService.get(url);
        OutputStream out = contents.getOutputStream(true);
        properties.store(out, null);
        out.close();
      } catch (MalformedURLException e) {
        e.printStackTrace();
        throw new IOException();
View Full Code Here

          ps = null;
          log.log(Level.SEVERE, e.toString());
          return false;
      }

      FileContents fc = null;
      try {
      fc = ps.get(getCodeBase());
    } catch (MalformedURLException e) {
      log.log(Level.SEVERE, e.toString());
      return false;
    } catch (FileNotFoundException e) {
      try {
        ps.create(getCodeBase(), 16 * 1024);
        ps.setTag(getCodeBase(), PersistenceService.DIRTY);
        fc = ps.get(getCodeBase());
      } catch (Exception e1) {
       
      }
    } catch (IOException e) {
      log.log(Level.SEVERE, e.toString());
      return false;
    }
     
    try
    {
      InputStream is = fc.getInputStream();
      s_prop.load(is);
      is.close();
    }
    catch (Throwable t)
    {
View Full Code Here

        // We store a properties file in the "configuration" address.
        try
        {
            URL config = new URL(bs.getCodeBase(), "configuration"); //$NON-NLS-1$
            FileContents contents = getOrCreateFile(ps, config);
            if (contents == null)
            {
                return;
            }

            InputStream in = contents.getInputStream();
            Properties props = new Properties();
            props.load(in);
            in.close();

            init(props);
View Full Code Here

     * @throws IOException  if there was a problem reading the muffin.
     */
    private FileContents getOrCreateFile(final PersistenceService ps, final URL address) throws IOException
    {
        ui.debug("Muffin lookup"); //$NON-NLS-1$
        FileContents toRet = null;
        try
        {
            toRet = ps.get(address);

            // See if the stream exists:
            InputStream in = toRet.getInputStream();
            in.close();
        }
        catch (FileNotFoundException fnf)
        {
            ui.debug("Creating muffins"); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of javax.jnlp.FileContents

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.