Package org.jboss.fresh.vfs

Examples of org.jboss.fresh.vfs.FileName


  /** Reads a chunk of content data and returns it as FileRetInfo object.
   *  FileOpInfo must be filled filename (file must exist), filepos and buf.
   */
  public FileReadInfo readContent(FileOpInfo info) throws Exception {

    FileName adjusted = root.absolutize(info.filename);
    File thefile = new File(fsroot, adjusted.toString());

    RandomAccessFile raf = new RandomAccessFile(thefile, "r");
    try {
      int free = (int) (raf.length()-info.offset);
      if(free <= 0)
View Full Code Here


   */
  public void removeContent(FileName name) throws Exception {

    // ves content je v podatkovni strukturi, ki bo odstranjena
    // 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

  }


  public void rename(FileName oldPath, FileName newPath) throws Exception {
    // v content delu ni ni� za postoriti na to temo
    FileName adjusted = root.absolutize(oldPath);
    File thefile = new File(fsroot, adjusted.toString());

    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

    // just check that path exists
    if(!fsroot.isDirectory())
      throw new RuntimeException("Root directory does not exist: " + rootpath);
 
    root = new FileName("/");
  }
View Full Code Here

   */
  public boolean exists(FileName name) throws Exception {

    // absolutize on root
    // append to fsroot
    FileName adjusted = root.absolutize(name);
   
    File thefile = new File(fsroot, adjusted.toString());

    return thefile.exists();
  }
View Full Code Here


  /** Path must be valid FileName object.
   */
  public int countChildren(FileName path) throws Exception {
    FileName adjusted = root.absolutize(path);
   
    File thefile = new File(fsroot, adjusted.toString());
    return thefile.list().length;
  }
View Full Code Here

  public List resolvePath(FileName path) throws Exception {

    LinkedList ls = new LinkedList();

    if(path == null) {
      ls.add(new FileName("/"));
      return ls;
    }

    FileName adjusted = root.absolutize(path);
    File thefile = new File(fsroot, adjusted.toString());
    //ls.add(new FileName(thefile.toURL().getPath().substring(rootlen)));
    ls.add(new FileName(thefile.getPath().substring(rootlen)));
    return ls;
  }
View Full Code Here

  public FileInfo getFileInfo(FileName name) throws Exception {
    // Convert to CompositeName
    // get FileInfo
    // return null if no info for name

    FileName adjusted = root.absolutize(name);

    File thefile = new File(fsroot, adjusted.toString());


    return fileToFileInfo(thefile);
  }
View Full Code Here

  }


  public List list(FileName path) throws Exception {

    FileName adjusted = root.absolutize(path);
    File thefile = new File(fsroot, adjusted.toString());
    File [] fs = thefile.listFiles();

    List l = new LinkedList();
    for(int i=0; i<fs.length; i++) {
      File f = (File) fs[i];
View Full Code Here

    throw new RuntimeException("Not implemented");
  }

  public void create(FileInfo fi) throws Exception {

    FileName adjusted = root.absolutize(fi.getFileName().toString());
    File thefile = new File(fsroot, adjusted.toString());

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

    if(fi.getFileType() == FileInfo.TYPE_DIR) {
      if(thefile.isDirectory()) {
View Full Code Here

TOP

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

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.