Package javax.jnlp

Examples of javax.jnlp.FileContents


        // 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;
            }

            // Open for output (true means "overwrite").
            PrintStream out = new PrintStream(contents.getOutputStream(true));
            if (destination != null)
            {
                out.println(DESTINATION_KEY + "=" + destination.toExternalForm()); //$NON-NLS-1$
            }
            out.println(PORT_KEY + "=" + localPort); //$NON-NLS-1$
View Full Code Here


  public ByteBuffer get(String key) {

    try {

      URL url = getUrlForKey(key);
      FileContents contents = service.get(url);
      byte[] data = new byte[(int) contents.getLength()];
      InputStream in = contents.getInputStream();

      in.read(data);

      return ByteBuffer.wrap(data);
View Full Code Here

      value.reset();
      if (service.create(url, value.remaining()) < value.remaining()) {
        throw new RuntimeException("Could not allocate enough space in persistence store.");
      }

      FileContents contents = service.get(url);
      OutputStream out = contents.getOutputStream(true);
      byte[] data = new byte[value.remaining()];
      value.get(data);

      out.write(data);
      out.flush();
View Full Code Here

    try {
      File file = FileROMChooser.chooseFileToLoad();
      if (file != null) cart = ROMLoader.load(file);
    } catch (AccessControlException e) {
      // Automatically tries FileServiceChooser if access is denied
      FileContents fileContents = FileServiceROMChooser.chooseFileToLoad();
      if (fileContents != null) cart = ROMLoader.load(fileContents);
    }
    if (cart != null) cartridgeInsert(cart, autoPower);
    else display.displayRequestFocus();
  }
View Full Code Here

public final class FileServiceROMChooser {

  public static FileContents chooseFileToLoad() {
    try {
      FileOpenService fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
      FileContents fileCon = fos.openFileDialog(null, ROMLoader.VALID_LOAD_FILE_EXTENSIONS);
      if (fileCon == null) return null;
      return fileCon;
    } catch (Exception ex) {
      System.out.println("File Service Cartridge Chooser: unable to open dialog\n" + ex);
      return null;
View Full Code Here

  protected byte[] cacheLookup(String name, byte[] digest) {

    try {

      URL url = getUrlForCacheEntry(name, digest);
      FileContents contents = persistenceService.get(url);

      /* If we get here, the digest is okay, so read the data. */
      InputStream in = contents.getInputStream();
      byte[] def = new byte[(int) contents.getLength()];

      in.read(def);

      return def;

View Full Code Here

      if (persistenceService.create(url, data.length) < data.length) {
        persistenceService.delete(url);
        throw new RuntimeException("Could not allocate enough space in persistence store.");
      }

      FileContents contents = persistenceService.get(url);
      OutputStream out = contents.getOutputStream(true);

      out.write(data);

    } catch (IOException e) {
View Full Code Here

    }
   
    try {
      ps.create(configURL, 1024); // 1024 bytes for our data

      FileContents fc = ps.get(configURL);
      DataOutputStream oos = new DataOutputStream(fc
          .getOutputStream(false));

      // scroll through hashMap and write key and value to file
      Set keys = scoreMap.keySet(); // get the keys
View Full Code Here

          .lookup("javax.jnlp.PersistenceService");
      BasicService bs = (BasicService) ServiceManager
          .lookup("javax.jnlp.BasicService");
      URL baseURL = bs.getCodeBase();
      URL configURL = new URL(baseURL, fileName);
      FileContents fc = ps.get(configURL);
      DataInputStream ois = new DataInputStream(fc.getInputStream());

      // read in data from muffin
      String key;

      // load hashMap as <String, Int> or <String, String>
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.