Package org.elfinder.servlets

Examples of org.elfinder.servlets.FsException


    if (os == null) {
      os = new ByteArrayOutputStream();
    }
    try {
      if (!newFile.createNewFile()) {
        throw new FsException("unable to create file");
      }
      try {
        FileOutputStream fs = new FileOutputStream(newFile);
        fs.write(os.toByteArray());
        fs.flush();
        fs.close();
      } catch (Exception ee) {
        newFile.delete();
        throw new FsException("unable to write file");
      }
    } catch (Exception e) {
      throw new FsException("unable to create file");
    }
  }
View Full Code Here


  }

  public void createFolder(File folder) throws FsException {
    boolean ok = folder.mkdir();
    if (!ok) {
      throw new FsException("Unable to create folder");
    }
  }
View Full Code Here

  }

  public void renameFileOrDirectory(File targetFile, File futureFile) throws FsException {
    boolean ok = targetFile.renameTo(futureFile);
    if (!ok) {
      throw new FsException("Unable to rename file from " + targetFile.getPath() + " to " + futureFile.getPath());
    }
  }
View Full Code Here

      }
    } catch (IOException e) {
      ok = false;
    }
    if (!ok) {
      throw new FsException("Unable to copy file from " + targetFile.getPath() + " to " + futureFile.getPath());
    }
  }
View Full Code Here

      FileUtils.copyFile(file, futureFile);
      if (!file.delete()) {
        throw new Exception();
      }
    } catch (Exception e) {
      throw new FsException("Unable to move file");
    }
  }
View Full Code Here

    }
  }

  public void removeFile(File path) throws FsException {
    if (!path.delete()) {
      throw new FsException("Unable to remove file");
    }
  }
View Full Code Here

    }
  }

  public void removeEmptyDirectory(File path) throws FsException {
    if (!path.delete()) {
      throw new FsException("Unable to remove directory");
    }
  }
View Full Code Here

TOP

Related Classes of org.elfinder.servlets.FsException

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.