Class<F> inputFormatClass, String path, Configuration configuration)
throws IOException
{
configuration = configuration == null ? new Configuration() : configuration;
Path normalizedPath = normalizePath(new Path(path));
final F inputFormat = ReflectionUtil.newInstance(inputFormatClass);
inputFormat.setFilePath(normalizedPath);
inputFormat.setOpenTimeout(0);
inputFormat.configure(configuration);
final FileSystem fs = FileSystem.get(normalizedPath.toUri());
FileStatus fileStatus = fs.getFileStatus(normalizedPath);
BlockLocation[] blocks = fs.getFileBlockLocations(fileStatus, 0, fileStatus.getLen());
inputFormat.open(new FileInputSplit(0, new Path(path), 0, fileStatus.getLen(), blocks[0].getHosts()));
return inputFormat;
}