Package org.jboss.fresh.vfs

Examples of org.jboss.fresh.vfs.VFSException


      // Noro - v primeru direktorija moramo narediti nov context !!!
      if(fi.getFileType() == FileInfo.TYPE_DIR) {

        try {
          fsroot.lookup(fi.getFileName().toString());
          throw new VFSException("Directory exists already: " + fi.getFileName());
        } catch(NameNotFoundException ex) {
        }

        Context nuctx = fsroot.createSubcontext(fi.getFileName().toString());
        nuctx.bind(INTERNAL_FILE, fileInfoToFNode(fi));
      } else {
        fsroot.bind(fi.getFileName().toString(), fileInfoToFNode(fi));
      }
    } catch(NamingException ex) {
      throw new VFSException("Could not create file: " + fi.getFileName(), ex);
    }
  }
View Full Code Here


      node = fsroot.lookup(fi.getFileName().toString());
    } catch(NameNotFoundException ex) {
    }
   
    if(node == null)
      throw new VFSException("File does not exist: " + fi.getFileName());
   
    if(node instanceof FNode) {
      updateFNodeWithFileInfo((FNode) node, fi);
    } else if(node instanceof Context) {
      node = ((Context) node).lookup(INTERNAL_FILE);
View Full Code Here

      node = fsroot.lookup(name.toString());
    } catch(NameNotFoundException ex) {
    }
   
    if(node == null)
      throw new VFSException("File does not exist: " + name);
   
    if(node instanceof FNode) {
      fsroot.unbind(name.toString());
    } else if(node instanceof Context) {
      // remove INTERNAL_FILE first
View Full Code Here

    RandomAccessFile raf = new RandomAccessFile(thefile, "r");
    try {
      int free = (int) (raf.length()-info.offset);
      if(free <= 0)
        throw new VFSException("Trying to read beyond the end of file");

      raf.seek(info.offset);
     
      int bufsize = 8192;
      boolean more = free > bufsize;
View Full Code Here

    // skupaj z metainfom
    FileName adjusted = root.absolutize(name);
    File thefile = new File(fsroot, adjusted.toString());

    if(thefile.exists() && !thefile.delete())
      throw new VFSException("Could not delete: " + name);
  }
View Full Code Here

    FileName adjDest = root.absolutize(newPath);
    File destFile = new File(fsroot, adjDest.toString());

    if(!thefile.renameTo(destFile))
      throw new VFSException("Could not move " + oldPath + " to " + newPath);

  }
View Full Code Here

      } else {
        return node;
      }
    }

    throw new VFSException("Link resolution infinitely looped: " + name);
  }
View Full Code Here

      RAF raf = null;
      if(node instanceof FNode) {
        raf = ((FNode) node).getFileContent().getRAF();
      } else if(node instanceof Context) {
        throw new VFSException(info.filename.toString() + " is a directory.");
      }

     
      if(info.append) {
        raf.seek(raf.getLength());
View Full Code Here

      try {
        node = getResolvedNode(info.filename.toString());
      } catch(NameNotFoundException ex) {
      }
     
      if(node == null) throw new VFSException("File not found: " + info.filename);

      RAF raf = null;
      if(node instanceof FNode) {
        raf = ((FNode) node).getFileContent().getRAF();
      } else if(node instanceof Context) {
        throw new VFSException(info.filename.toString() + " is a directory.");
      }
     
      raf.seek(info.offset);
      int size = 8192;
      int togo = (int) (raf.getLength() - info.offset);
View Full Code Here

    tags.put(thefile, fi.getTag());

    if(fi.getFileType() == FileInfo.TYPE_DIR) {
      if(thefile.isDirectory()) {
        throw new VFSException("Directory exists already: " + fi.getFileName());
      } if(thefile.exists()) {
        throw new VFSException("File exists already (is not a directory): " + fi.getFileName());
      }

      if(!thefile.mkdir())
        throw new VFSException("Could not create directory: " + fi.getFileName());

    } else if(!thefile.createNewFile()) {
        throw new VFSException("Could not create file: " + fi.getFileName());
    }
  }
View Full Code Here

TOP

Related Classes of org.jboss.fresh.vfs.VFSException

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.