Examples of canWrite()


Examples of java.io.File.canWrite()

    if ( !file.exists()){
     
      throw( new IOException( "plist file '" + file + "' doesn't exist" ));
    }
   
    if ( !file.canWrite()){
     
      throw( new IOException( "plist file '" + file + "' is read only" ));
    }
  }
 
View Full Code Here

Examples of java.io.File.canWrite()

        getModel().setFileEnabled(!getModel().isFileEnabled());
      } else if (src == selectButton) {
        int result = chooser.showSaveDialog(getLogFrame());
        if (result != JFileChooser.APPROVE_OPTION) return;
        File file = chooser.getSelectedFile();
        if (file.exists() && (!file.canWrite() || file.isDirectory())) {
          JOptionPane.showMessageDialog(getLogFrame(),
            StringUtil.format(Strings.get("fileCannotWriteMessage"), file.getName()),
            Strings.get("fileCannotWriteTitle"),
            JOptionPane.OK_OPTION);
          return;
View Full Code Here

Examples of java.io.File.canWrite()

        else if (aFile.isFile())
          aFileType = "-";
        else
          aFileType = "?";
        String aFileRead = (aFile.canRead() ? "r" : "-");
        String aFileWrite = (aFile.canWrite() ? "w" : "-");
        String aFileExe = "-";
        if (canExecute != null)
          try {
            if (((Boolean) canExecute.invoke(aFile, Utils.EMPTY_OBJECTS)).booleanValue())
              aFileExe = "x";
View Full Code Here

Examples of java.io.File.canWrite()

    }

    private void testReadOnlyFiles(boolean setReadOnly) throws Exception {
        new File(System.getProperty("java.io.tmpdir")).mkdirs();
        File f = File.createTempFile("test", "temp");
        assertTrue(f.canWrite());
        f.setReadOnly();
        assertTrue(!f.canWrite());
        f.delete();

        f = File.createTempFile("test", "temp");
View Full Code Here

Examples of java.io.File.canWrite()

    private void testReadOnlyFiles(boolean setReadOnly) throws Exception {
        new File(System.getProperty("java.io.tmpdir")).mkdirs();
        File f = File.createTempFile("test", "temp");
        assertTrue(f.canWrite());
        f.setReadOnly();
        assertTrue(!f.canWrite());
        f.delete();

        f = File.createTempFile("test", "temp");
        RandomAccessFile r = new RandomAccessFile(f, "rw");
        r.write(1);
View Full Code Here

Examples of java.io.File.canWrite()

        f = File.createTempFile("test", "temp");
        RandomAccessFile r = new RandomAccessFile(f, "rw");
        r.write(1);
        f.setReadOnly();
        r.close();
        assertTrue(!f.canWrite());
        f.delete();

        deleteDb("readonly");
        Connection conn = getConnection("readonly");
        Statement stat = conn.createStatement();
View Full Code Here

Examples of java.io.File.canWrite()

               
                String filename = dco.getFilename();
                File currentFile = new File(filename);
                if (!currentFile.exists()) {
                    listener.notify(DcResources.getText("msgFileDoesNotExist", currentFile.toString()));
                } else if (!currentFile.canWrite()) {
                    listener.notify(DcResources.getText("msgFileNotWritable", currentFile.toString()));                   
                } else {
                    filename = pattern.getFilename(dco, currentFile, baseDir);
                   
                    File newFile = new File(filename);
View Full Code Here

Examples of java.io.File.canWrite()

      {
        getStatusBar().setStatus(StatusType.ERROR,
            getResources().getString("htmlexportdialog.targetIsNoFile")); //$NON-NLS-1$
        return false;
      }
      if (f.canWrite() == false)
      {
        getStatusBar().setStatus(StatusType.ERROR,
            getResources().getString("htmlexportdialog.targetIsNotWritable")); //$NON-NLS-1$
        return false;
      }
View Full Code Here

Examples of java.io.File.canWrite()

     */
    private ClassCache(String[] paths) {
        ArrayList keepers = new ArrayList();
        for (int i = 0; i < paths.length; i++) {
            File file = new File(paths[i]);
            if (file.isDirectory() && file.canWrite()) {
                keepers.add(paths[i]);
            }
        }
        m_paths = new String[keepers.size()];
        m_roots = new File[keepers.size()];
View Full Code Here

Examples of java.io.File.canWrite()

      {
        getStatusBar().setStatus(StatusType.ERROR,
            getResources().getString("rtf-exportdialog.targetIsNoFile")); //$NON-NLS-1$
        return false;
      }
      if (f.canWrite() == false)
      {
        getStatusBar().setStatus(StatusType.ERROR,
            getResources().getString(
                "rtf-exportdialog.targetIsNotWritable")); //$NON-NLS-1$
        return false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.