Package java.io

Examples of java.io.File$Pair


      // grab a zip file entry
      ZipEntry entry = (ZipEntry) zipFileEntries.nextElement();

      String currentEntry = entry.getName();

      File destFile = new File(unzipDestinationDirectory, currentEntry);

      // grab file's parent directory structure
      File destinationParent = destFile.getParentFile();

      // create the parent directory structure if needed
      destinationParent.mkdirs();

      // extract file if not a directory
      if (!entry.isDirectory()) {
        ObjectConverterUtil.write(zipFile.getInputStream(entry),
            destFile);
View Full Code Here


    }
    zipFile.close();
  }

  static File createTempDirectory() throws IOException {
    File temp = File.createTempFile("temp", Long.toString(System.nanoTime()));

    temp.delete();

    if (!(temp.mkdir())) {
      throw new IOException("Could not create temp directory: "
          + temp.getAbsolutePath());
    }

    return temp;
  }
View Full Code Here

     
    return deploymentBaseName;
  }

  public VirtualFile applyTemplate(DeploymentTemplateInfo sourceInfo) throws Exception {
    File dsXml = File.createTempFile(getClass().getSimpleName(),TranslatorParserDeployer.TRANSLATOR_SUFFIX);
    writeTemplate(dsXml, sourceInfo);
    return VFS.getRoot(dsXml.toURI());
  }
View Full Code Here

  public void setUseDisk(boolean flag) {
    this.useDisk = flag;
  }

  public void setDiskDirectory(String dir) {
    this.bufferDir = new File(dir, "buffer"); //$NON-NLS-1$
  }
View Full Code Here

   * @param url
   * @return cacheFile
   */
  protected File getCacheFile(URL url) {
    // does the file exists on the filesystem ?
    File cacheFile = new File(url2Filename(url));
    if (! (cacheFile.exists() && (cacheFile.isFile()))) {
    return null;
    }
    return cacheFile;
  }
View Full Code Here

   * simple heuristic to determine the possible MIME type.
   */
  public void removeDocument(URL u) {
  String ext = getExtension(u);
  if (ext == null) return;
  File cacheFile = getCacheFile(u);
  if (cacheFile == null) return ;
 
  cacheFile.delete();
  }
View Full Code Here

   * to be a dynamic document.
   */
  public HttpDoc retrieveFromCache(URL u) {
  String ext = getExtension(u);
  if (ext == null) return null;
  File cacheFile = getCacheFile(u);
  if (cacheFile == null) return null;
   
    // create a buffer;
    long size = cacheFile.length();
    if (size > Integer.MAX_VALUE) {
      log.info("File too large");
      return null;
    }

View Full Code Here

      if (filename.charAt(i) == File.separatorChar) {
  pos = i;
  i = -1;
      }
    }
    File dir = new File(filename.substring(0, pos));
    dir.mkdirs();
  }
View Full Code Here

    // Allow a properties file in the WekaPackageManager.PROPERTIES_DIR to override
    Properties userProps = new Properties(defaultProps);
    if (!WekaPackageManager.PROPERTIES_DIR.exists()) {
      WekaPackageManager.PROPERTIES_DIR.mkdir();
    }
    File propFile = new File(WekaPackageManager.PROPERTIES_DIR.toString()
                             + File.separator
                             + resourceName);

    if (propFile.exists()) {
      try {
        userProps.load(new FileInputStream(propFile));
      } catch (Exception ex) {
        throw new Exception("Problem reading user properties: " + propFile);
      }
    }

    // Allow a properties file in the current directory to override
    Properties localProps = new Properties(userProps);
    propFile = new File(resourceName);
    if (propFile.exists()) {
      try {
        localProps.load(new FileInputStream(propFile));
      } catch (Exception ex) {
        throw new Exception("Problem reading local properties: " + propFile);
      }
View Full Code Here

   * @param absolute the File to convert to relative path
   * @return a File with a path that is relative to the user's directory
   * @exception Exception if the path cannot be constructed
   */
  public static File convertToRelativePath(File absolute) throws Exception {
    File        result;
    String      fileStr;
   
    result = null;
   
    // if we're running windows, it could be Cygwin
    if (File.separator.equals("\\")) {
      // Cygwin doesn't like upper case drives -> try lower case drive
      try {
        fileStr = absolute.getPath();
        fileStr =   fileStr.substring(0, 1).toLowerCase()
                  + fileStr.substring(1);
        result = createRelativePath(new File(fileStr));
      }
      catch (Exception e) {
        // no luck with Cygwin workaround, convert it like it is
        result = createRelativePath(absolute);
      }
View Full Code Here

TOP

Related Classes of java.io.File$Pair

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.