private static final String SCHEME = "torrent"; //$NON-NLS-1$
public ID createInstance(Object[] args) throws IDCreateException {
if (args == null || args.length == 0) {
throw new IDCreateException("parameters cannot be null or of 0 length");
} else {
File file = null;
if (args[0] instanceof String) {
file = new File((String) args[0]);
} else if (args[0] instanceof File) {
file = (File) args[0];
} else {
throw new IDCreateException("parameter-0 must be of type File or String");
}
if (file.isDirectory()) {
throw new IDCreateException("file="+
file.getAbsolutePath()+" must not be a directory");
} else if (file.canRead()) {
return new TorrentID(this, file);
} else {
throw new IDCreateException("file="+file.getAbsolutePath()+" cannot be read");
}
}
}