コード例 #1
0
ファイル: VirtualFileManager.java プロジェクト: benjp/juzu
 @Override
 public FileObject getFileForInput(Location location, String packageName, String relativeName)
     throws IOException {
   FileKey key = FileKey.newResourceName(packageName, relativeName);
   FileManager files = getFiles(location);
   if (files != null) {
     return files.getReadable(key);
   } else {
     throw new FileNotFoundException("Cannot write: " + location);
   }
 }
コード例 #2
0
ファイル: VirtualFileManager.java プロジェクト: benjp/juzu
 @Override
 public JavaFileObject getJavaFileForOutput(
     Location location, String className, JavaFileObject.Kind kind, FileObject sibling)
     throws IOException {
   FileManager files = getFiles(location);
   if (files != null) {
     FileKey key = FileKey.newJavaName(className, kind);
     return files.getWritable(key);
   } else {
     throw new UnsupportedOperationException("Location " + location + " not supported");
   }
 }
コード例 #3
0
ファイル: VirtualFileManager.java プロジェクト: benjp/juzu
  @Override
  public FileObject getFileForOutput(
      Location location, String packageName, String relativeName, FileObject sibling)
      throws IOException {
    FileKey key = FileKey.newResourceName(packageName, relativeName);

    // Address a bug
    if (location == StandardLocation.SOURCE_PATH) {
      FileObject file = sourcePath.getReadable(key);
      if (file == null) {
        throw new FileNotFoundException("Not found:" + key.toString());
      }
      return file;
    } else {
      FileManager files = getFiles(location);
      if (files != null) {
        return files.getWritable(key);
      } else {
        throw new FileNotFoundException("Cannot write: " + location);
      }
    }
  }
コード例 #4
0
ファイル: VirtualFileManager.java プロジェクト: benjp/juzu
 @Override
 public boolean isSameFile(FileObject a, FileObject b) {
   FileKey ka = ((JavaFileObjectImpl) a).getKey();
   FileKey kb = ((JavaFileObjectImpl) b).getKey();
   return ka.equals(kb);
 }