Package java.io

Examples of java.io.File


    mProperties = prop;
  }
 
  public DefaultSettings() {
    mProperties = new Properties();
    File settingsFile = new File(FILENAME);
    if (settingsFile.canRead() && !TVBrowser.isTransportable()) {
      StreamUtilities.inputStreamIgnoringExceptions(settingsFile,
          new InputStreamProcessor() {

            @Override
            public void process(InputStream input) throws IOException {
View Full Code Here


  public static JButton createBrowseButton(final Component parent, final JTextField tf) {
    JButton bt = new JButton(mLocalizer.msg("change", "Change"));
    bt.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        File file = new File(tf.getText());
        JFileChooser fileChooser = new JFileChooser(file.getParent());
        String[] extArr = { ".jpg", ".jpeg", ".gif", ".png" };
        fileChooser.setFileFilter(new util.ui.ExtensionFileFilter(extArr, ".jpg, .gif, png"));
        if (fileChooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
          File selection = fileChooser.getSelectedFile();
          if (selection != null) {
            tf.setText(selection.getAbsolutePath());
          }
        }
      }
    });
View Full Code Here

      try {
        mSystemTray = java.awt.SystemTray.getSystemTray();
        boolean isSupported = java.awt.SystemTray.isSupported();
        if(isSupported) {
          try {
            if(new File("imgs/TrayIcon.png").isFile()) {
              mTrayIcon = new TrayIcon(ImageIO.read(new File("imgs/TrayIcon.png")), tooltip);
            }
            else {
              Dimension trayIconSize = getTrayIconSize();
              BufferedImage trayIconImage = null;
              Color backgroundColor = null;

              if(trayIconSize.height > 16 && trayIconSize.height <= 32 && new File("imgs/tvbrowser32.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser32.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else if(trayIconSize.height > 32 && trayIconSize.height <= 48 && new File("imgs/tvbrowser48.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser48.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else if(trayIconSize.height > 48 && new File("imgs/tvbrowser128.png").isFile()) {
                trayIconImage = UiUtilities.scaleIconToBufferedImage(ImageIO.read(new File("imgs/tvbrowser128.png")),
                    trayIconSize.width, trayIconSize.height, BufferedImage.TYPE_INT_ARGB, backgroundColor);
              }
              else {
                trayIconImage = ImageIO.read(new File("imgs/tvbrowser16.png"));
              }

              mTrayIcon = new TrayIcon(trayIconImage, tooltip);
            }
          }catch(Throwable sizeFault) {
            mTrayIcon = new TrayIcon(ImageIO.read(new File("imgs/tvbrowser16.png")), tooltip);
          }

          mTrayParent = new JDialog();
          mTrayParent.setTitle("Tray-Menu");
View Full Code Here

          path = bean.getDirectory();
        } catch( Exception e ) {
          throw new ServletException(e);
        }       
        String realPath = servlet.getServletContext().getRealPath("/");
        File resources = new File(realPath,ResourceServlet.relativePath);
        File tresources = new File(resources,path);
       
        File as = new File(tresources, request.getParameter("id"));
        as.delete();
       
        // Forward to the next page
        return (mapping.findForward("ok"));

    }
View Full Code Here

          path = bean.getDirectory();
        } catch( Exception e ) {
          throw new ServletException(e);
        }       
        String realPath = servlet.getServletContext().getRealPath("/");
        File resources = new File(realPath,ResourceServlet.relativePath);
        File tresources = new File(resources,path);
       
        String on = sform.getFile().getFileName();
        String ext = (on.indexOf(".")!=-1)?on.substring(on.indexOf(".")+1):"res";           
        String fileName = sform.getName()+"."+ext;
       
        File ofile = new File( tresources, fileName );
        FileOutputStream fos = new FileOutputStream(ofile);
        fos.write(sform.getFile().getFileData());
       
        // clean the form
        sform.setName("");
View Full Code Here

        } catch( Exception e ) {
          throw new ServletException(e);
        }
       
        String realPath = servlet.getServletContext().getRealPath("/");
        File resources = new File(realPath,ResourceServlet.relativePath);
        File tresources = new File(resources,path);
       
        File[] files = tresources.listFiles();
        Vector mfiles = new Vector();
        for( int i=0; i<files.length; i++ ) {
          mfiles.add(new org.nextime.ion.backoffice.bean.File(files[i]));
        }
       
View Full Code Here

  }*/
 
  @Doc(text = "Deploy a VDB from file")
  public static void deployVDB(
      @Doc(text = "file name") String vdbFile) throws AdminException, FileNotFoundException {
    File file = new File(vdbFile);
    FileInputStream fis = new FileInputStream(file);
    try {
      getAdmin().deployVDB(file.getName(), fis);
    } finally {
      try {
        fis.close();
      } catch (IOException e) {
      }
View Full Code Here

      path = bean.getDirectory();
    } catch (Exception e) {
      throw new ServletException(e);
    }
    String realPath = getServletContext().getRealPath("/");
    File resources = new File(realPath, ResourceServlet.relativePath);
    File tresources = new File(resources, path);
    File tfile = new File(tresources, resourceId);

    if (request.getParameter("width") != null
      || request.getParameter("height") != null) {

      int w = Integer.parseInt(request.getParameter("width") + "");
      int h = Integer.parseInt(request.getParameter("height") + "");

     
      File cache = new File(resources, "cache");
      File possibleCached =
        new File(cache, w + "_" + h + "_" + tfile.getName() + ".jpg");
     
      String mimeType =
        FileTypeMap.getDefaultFileTypeMap().getContentType(possibleCached);
      response.setContentType(mimeType);
     
      if (possibleCached.exists()) {
        // send content
        byte[] buffer = new byte[(int) possibleCached.length()];
        FileInputStream fis = new FileInputStream(possibleCached);
        fis.read(buffer);
        fis.close();
        response.getOutputStream().write(buffer);
        response.getOutputStream().flush();
View Full Code Here

            });
          }
    });
        console.run();
        if (args.length == 1) {
          console.loadScriptFile(new File(args[0]));
        }
  }
View Full Code Here

        this.resourceContext = resourceContext;
    }

    @Override
    protected void destroyArchive(File archive) {
        File tempDir = archive.getParentFile();
        archive.delete();
        tempDir.delete();
    }
View Full Code Here

TOP

Related Classes of java.io.File

Copyright © 2015 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.