Clover coverage report -
Coverage timestamp: Fri Nov 19 2004 13:41:51 PST
file stats: LOC: 54   Methods: 6
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FileSystemImpl.java 50% 66.7% 83.3% 64.9%
coverage coverage
 1    package photospace.vfs;
 2   
 3    import java.io.*;
 4   
 5    public class FileSystemImpl
 6    implements java.io.Serializable, FileSystem
 7    {
 8    private File root;
 9   
 10  41 public File getRoot()
 11    {
 12  41 return root;
 13    }
 14   
 15  8 public void setRoot(File root)
 16    throws IOException
 17    {
 18  8 this.root = root.getCanonicalFile();
 19    }
 20   
 21  16 public File getFile(String path)
 22    throws IOException
 23    {
 24  0 if (path == null || "".equals(path.trim())) throw new FileNotFoundException("Empty path is not a file.");
 25  16 File file = new File(getRoot(), path).getCanonicalFile();
 26  0 if (!file.exists()) throw new FileNotFoundException(path + " not found.");
 27  16 return file;
 28    }
 29   
 30  2 public File getAsset(String path)
 31    throws FileNotFoundException, IOException
 32    {
 33  2 File asset = getFile(path);
 34  0 if (!asset.isFile()) throw new FileNotFoundException(path + " is not a file.");
 35  2 return asset;
 36    }
 37   
 38  0 public File getDirectory(String path)
 39    throws FileNotFoundException, IOException
 40    {
 41  0 File dir = getFile(path);
 42  0 if (!dir.isDirectory()) throw new FileNotFoundException(path + " is not a directory.");
 43  0 return dir;
 44    }
 45   
 46  19 public String getPath(File file)
 47    {
 48  19 String path = file.getPath().substring(getRoot().getPath().length());
 49  19 path = path.replaceAll("\\\\", "/"); //todo: make cross-platform
 50  6 if (file.isDirectory() && ! path.endsWith("/")) path += "/";
 51  19 return path;
 52    }
 53   
 54    }