Code example for FileNotFoundException

0
  public HdfsFileReader(FileSystem fileSystem, Path path, int bufferSize) 
      throws IOException { 
    this.path = path; 
    LOG.debug("Opening reader on {}", path); 
    if (!fileSystem.exists(path)) { 
      throw new FileNotFoundException(path.toString()); 
    } 
    inputStream = fileSystem.open(path, bufferSize); 
    FileStatus fileStatus = fileSystem.getFileStatus(path); 
    length = fileStatus.getLen(); 
  } 
   
  public HdfsFileReader(FileSystem fileSystem, Path path) throws IOException { 
    this(fileSystem, path, HdfsDirectory.BUFFER_SIZE); 
  } 
   
  public long length() { 
    return length; 
  }