Example #1
0
 public Vector<EasytoryFile> findFiles(String fileName) {
   EasytoryFile file = fileMap.get(fileName);
   if (file != null) {
     return file.list();
   } else {
     return new Vector<EasytoryFile>();
   }
 }
Example #2
0
 public byte[] readFile(String fileName, int from, int to)
     throws FileNotFoundException, IOException {
   EasytoryFile file = fileMap.get(fileName);
   if (file != null) {
     return file.getBinaryContent(from, to);
   } else {
     throw new FileNotFoundException("File '" + fileName + "' not found.");
   }
 }
Example #3
0
 public EasytoryFile getFileInformation(String fileName) throws FileNotFoundException {
   EasytoryFile file = fileMap.get(fileName);
   if (file != null) {
     System.out.println("getInfo: " + file.getFileName());
     return file;
   } else {
     System.out.println("File '" + fileName + "' not found.");
     throw new FileNotFoundException("File '" + fileName + "' not found.");
   }
 }
Example #4
0
 private EasytoryFile createFile(EasytoryFile parentDir, String fileName, boolean isDirectory) {
   String parentFileName = parentDir.getPath() + parentDir.getFileName();
   if (!parentFileName.endsWith(slash)) parentFileName = parentFileName + slash;
   String newFileName = parentFileName + fileName;
   EasytoryFile newFile =
       new EasytoryFile(fileName, parentFileName, isDirectory, fileIndexCounter);
   fileMap.put(newFileName, newFile);
   parentDir.addChild(newFile);
   fileIndexCounter++;
   System.out.println("Create: " + newFileName);
   return newFile;
 }
 @Override
 public boolean nextFileInfo(FileInfo info) {
   if (cursor < fileListSize) {
     EasytoryFile eFile = fileList.elementAt(cursor);
     System.out.println("SearchContext:nextFileInfo " + eFile.getFileName());
     cursor++;
     eFile.getJLanFileInfo(info);
     return true;
   } else {
     System.out.println("SearchContext:nextFileInfo no more files");
     return false;
   }
 }