Get a partial listing of the indicated directory

@param src          the directory name
@param startAfter   the name to start after
@param needLocation if blockLocations need to be returned
@return a partial listing starting after startAfter
969404
public DirectoryListing getPartialListing(String src, byte[] startAfter,
                                            boolean needLocation)
    throws IOException {
    DirectoryListing stats;
    src = dir.normalizePath(src);
    byte[][] names = INode.getPathComponents(src);
    INode[] inodes = new INode[names.length];
    readLock();
    try {
      dir.rootDir.getExistingPathINodes(names, inodes);
      getListingCheck(src, inodes);
      stats = dir.getPartialListing(src, inodes[inodes.length-1],
          startAfter, needLocation);
    } finally {
      readUnlock();
    }
    if (auditLog.isInfoEnabled()) {
      logAuditEvent(getCurrentUGI(),
        Server.getRemoteIp(),
        "listStatus", src, null, null);
    }
    return stats;
  }
1077981
@Override
    public BlockLocation[] getFileBlockLocations(FileStatus file, long start,
        long len) throws IOException {

      if (file == null) {
        return null;
      }
      String srep = makeAbsolute(file.getPath()).toUri().getPath();
      String[][] hints = kfsImpl.getDataLocation(srep, start, len);
      if (hints == null) {
        return null;
      }
      BlockLocation[] result = new BlockLocation[hints.length];
      long blockSize = getDefaultBlockSize();
      long length = len;
      long blockStart = start;
      for(int i=0; i < result.length; ++i) {
        result[i] = new BlockLocation(null, hints[i], blockStart, 
                                      length < blockSize ? length : blockSize);
        blockStart += blockSize;
        length -= blockSize;
      }
      return result;
    }
71888
public static StashLocation getStashLocation(URI location) {
        checkArgument(getLocationType(location) == LocationType.STASH, "Not a stash location");

        String host, path;
        boolean useLatestDirectory;

        Matcher matcher = getLocatorMatcher(location);
        if (matcher.matches()) {
            // Stash is only available for the default group.  Make sure that's the case here
            String group = Objects.firstNonNull(matcher.group("group"), DEFAULT_GROUP);
            checkArgument(DEFAULT_GROUP.equals(group), "Stash not available for group: %s", group);

            // Stash it not available for local
            String universe = matcher.group("universe");
            checkArgument(universe != null, "Stash not available for local");

            Region region = getRegion(Objects.firstNonNull(matcher.group("region"), DEFAULT_REGION));

            host = getS3BucketForRegion(region);
            path = getS3PathForUniverse(universe);
            useLatestDirectory = true;
        } else {
            // The location refers to the actual S3 bucket and path
            host = location.getHost();
            path = location.getPath();
            // Stash paths don't have a leading slash
            if (path != null && path.startsWith("/")) {
                path = path.substring(1);
            }
            useLatestDirectory = false;
        }

        return new StashLocation(host, path, useLatestDirectory);
    }
1189728
private void parseLastLocationStep(String selector,
                                     int start )
    throws InvalidXPathSyntaxException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass,
               "parseLastLocationStep",
               "selector: " + selector + ", start: " + start); 
    int stepStart = start;
    int stepEnd = selector.length();
    int posOpenBracket = selector.indexOf("[", start);
    
    String remnant = null;
    String fullRemnant = null;

    // This is the final location step, bump the counter
    locationStep++;
    
    if(posOpenBracket > stepEnd || posOpenBracket == -1)
    {
      // Set posOpenBracket to avoid further processing
      posOpenBracket = -1;
      // No brackets so the remnant is the whole of the location step
      remnant = selector.substring(start,stepEnd); 
      fullRemnant = selector.substring(0, stepEnd);
         
    }

    // Now we'll work with the brackets
    int posCloseBracket = selector.indexOf("]", start); 
    boolean wrapWholeStep = false;
    boolean foundPredicates = false;
    ArrayList<Selector> tempSelOperands = new ArrayList<Selector>();  
    
    while (posOpenBracket >= 0)
    {
      foundPredicates = true;
      if(posCloseBracket < posOpenBracket)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          tc.exit(this,cclass, "parseLastLocationStep", "bracket error");   
       
        InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector);
        FFDC.processException(cclass,
            "com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl",
            iex,
            "1:497:1.16"); 
        
        throw iex;
      }
      else
      {
        // The full name of the selector so far. The full name is used in position assignment when
        // determining uniqueness of names. Only a full name will do.
        String full = selector.substring(0,posOpenBracket);
        // Factor out the location step first but be careful we may have a predicate
        if(start != posOpenBracket)
        {
          // Go ahead and deal with the location step
          String step = selector.substring(start,posOpenBracket);
          // Add an IdentifierImpl for the location step to the array list
          // N.B. "false" cos we've bumped the location step already
          tempSelOperands.add(createIdentifierForSubExpression(step, full, false, false)); 
        }
        
        // Now parse the predicate
        String predicate = selector.substring(posOpenBracket + 1,posCloseBracket);
        Selector parsedPredicate = parsePredicate(predicate, full);
        
        // Check whether we were able to parse
        if(parsedPredicate == null)
        {
          // Unable to parse the expression, so we'll wrap the whole step
//          tempSelOperands.add(createIdentifierForSubExpression(predicate, false));
          wrapWholeStep = true;
          break;
        }
        else
        {
          // we were able to parse the expression with the MatchParser
          parsedPredicate.setExtended();
          tempSelOperands.add(parsedPredicate);
        }       
      }
        
      // Move to beyond the close bracket
      start = posCloseBracket+1;
      //Are there any more brackets?
      posOpenBracket = selector.indexOf("[", start);
      posCloseBracket = selector.indexOf("]", start); 
      
      // Have we found the last bracket in this location step?
      if(posOpenBracket > stepEnd || posOpenBracket == -1)
      {
        // Set posOpenBracket to avoid further processing
        posOpenBracket = -1;
        
        // Set up the remnant
        if(start < stepEnd)
        {
          remnant = selector.substring(start,stepEnd);
          fullRemnant = selector.substring(0, stepEnd);
        }
      }
    } // eof while

    if(foundPredicates)
    {
      // If we determined that we cannot parse this location step, then wrap it
      if(wrapWholeStep)
      {
        remnant = null;
        wrapLastLocationStep(selector, stepStart, false);
      }
      else
      {
        // PostProcessing here
        selOperands.addAll(tempSelOperands);
      }
    }
    
    // Process the remnant
    if(remnant != null)
    {
      Selector parsedPredicate = parsePredicate(remnant, fullRemnant);
      // Check whether we were able to parse
      if(parsedPredicate == null)
      {
        // Unable to parse the expression, so we'll wrap it
        selOperands.add(createIdentifierForSubExpression(remnant, fullRemnant, false, true));
      }
      else
      {
        // we were able to parse the expression with the MatchParser
        parsedPredicate.setExtended();
        selOperands.add(parsedPredicate);
      }                
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "parseLastLocationStep");     
  }
410552
function getScanStartPosition(enclosingNode, originalRange, sourceFile) {
            var start = enclosingNode.getStart(sourceFile);
            if (start === originalRange.pos && enclosingNode.end === originalRange.end) {
                return start;
            }
            var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile);
            if (!precedingToken) {
                // no preceding token found - start from the beginning of enclosing node
                return enclosingNode.pos;
            }
            // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal)
            // start from the beginning of enclosingNode to handle the entire 'originalRange'
            if (precedingToken.end >= originalRange.pos) {
                return enclosingNode.pos;
            }
            return precedingToken.end;
        }
524945
public StorageDir getDir(BlockStoreLocation location) {
    if (location.equals(BlockStoreLocation.anyTier())
        || location.equals(BlockStoreLocation.anyDirInTier(location.tierAlias()))) {
      throw new IllegalArgumentException(
          ExceptionMessage.GET_DIR_FROM_NON_SPECIFIC_LOCATION.getMessage(location));
    }
    return getTier(location.tierAlias()).getDir(location.dir());
  }
607849
public static UnixPath getPath(boolean permitEmptyComponents, String first, String... more) {
    if (more.length == 0) {
      return getPath(permitEmptyComponents, first);
    }
    StringBuilder builder = new StringBuilder(first);
    for (int i = 0; i < more.length; i++) {
      String part = more[i];
      if (part.isEmpty()) {
        continue;
      } else if (isAbsoluteInternal(part)) {
        if (i == more.length - 1) {
          return new UnixPath(permitEmptyComponents, part);
        } else {
          builder.replace(0, builder.length(), part);
        }
      } else if (hasTrailingSeparatorInternal(builder)) {
        builder.append(part);
      } else {
        builder.append(SEPARATOR);
        builder.append(part);
      }
    }
    return new UnixPath(permitEmptyComponents, builder.toString());
  }
664612
@Requires("location != null")
  public List<? extends File> getLocation(Location location) {
    Iterable<? extends File> path = fileManager.getLocation(location);
    if (path == null) {
      return null;
    }

    ArrayList<File> locations = new ArrayList<File>();
    for (File entry : path) {
      locations.add(entry);
    }
    return locations;
  }
184618
public static <R> List<R> applySubFilePathsAndGetAppliedList(
			Path startDirectoryPath, Function<Path, R> function) {
		return applySubFilePathsAndGetAppliedList(startDirectoryPath,
				Integer.MAX_VALUE, JMPredicate.getTrue(), function);
	}
216537
private RemoteIterator<LocatedFileStatus> iteratorListing(final String src)
  throws IOException {
    return new RemoteIterator<LocatedFileStatus>() {
      private LocatedDirectoryListing thisListing;
      private int i;

      { // initializer
        // fetch the first batch of entries in the directory

        thisListing = namenode.getLocatedPartialListing(
            src, HdfsFileStatus.EMPTY_NAME);
        if (thisListing == null) { // the directory does not exist
          throw new FileNotFoundException("File " + src + " does not exist.");
        }
      }

      @Override
      public boolean hasNext() throws IOException {
        if (i>=thisListing.getPartialListing().length
            && thisListing.hasMore()) {
          // current listing is exhausted & fetch a new listing
          thisListing = namenode.getLocatedPartialListing(
              src, thisListing.getLastName());
          if (thisListing == null) {
            throw new FileNotFoundException("File " + src + " does not exist.");
          }
          i = 0;
        }
        return i < thisListing.getPartialListing().length;
      }

      @Override
      public LocatedFileStatus next() throws IOException {
        if (!hasNext()) {
          throw new java.util.NoSuchElementException("No more entry in " + src);
        }
        return HdfsFileStatus.toLocatedFileStatus(thisListing.getPartialListing()[i],
            thisListing.getBlockLocations()[i++], src);
      }
    };

  }
377436
public static List<Path> getSubFilePathList(Path startDirectoryPath,
			int maxDepth) {
		return getSubPathList(startDirectoryPath, maxDepth, RegularFileFilter);
	}
377413
protected final Split startStopwatch(HandlerLocation location) {
		Split split = stopwatchSource.start(location);
		location.setSplit(split);
		return split;
	}
824671
private List<Object> getFilePreviews(final String[] fileList, final String locationFull,
      final IStreamProvider streamProvider, final boolean renderResultsAsHtml) {
    final List<Object> files = new ArrayList<>();
    InputStream csvInputStream = null;

    try {
      for (final String fileName : fileList) {
        final Map<String, Object> file = new HashMap<>();
        file.put("name", fileName);

        final String filePath = locationFull + "/" + fileName;
        csvInputStream = streamProvider.getFileInputStream(filePath);
        final Scanner rowScanner = new Scanner(csvInputStream, StandardCharsets.UTF_8.toString());

        final List<Object> lines = new ArrayList<>();
        int lineNumber = 0;
        while (rowScanner.hasNextLine()
            && lineNumber < ReportalMailCreator.NUM_PREVIEW_ROWS) {
          final String csvLine = rowScanner.nextLine();
          final String[] data = csvLine.split("\",\"");
          final List<String> line = new ArrayList<>();
          for (final String item : data) {
            String column = item.replace("\"", "");
            if (!renderResultsAsHtml) {
              column = StringEscapeUtils.escapeHtml(column);
            }
            line.add(column);
          }
          lines.add(line);
          lineNumber++;
        }

        file.put("content", lines);

        if (rowScanner.hasNextLine()) {
          file.put("hasMore", true);
        }

        files.add(file);
        rowScanner.close();
      }
    } catch (final Exception e) {
      logger.debug("Error encountered while processing files in "
          + locationFull, e);
    } finally {
      IOUtils.closeQuietly(csvInputStream);
    }

    return files;
  }
467891
def fetch_starting_at_coord(self,coord):
    #b2 = BAMFile(self.path,blockStart=coord[0],innerStart=coord[1],index_obj=self.index,reference=self._reference)
    
    b2 = BAMFile(self.path,BAMFile.Options(blockStart=coord[0],innerStart=coord[1],reference=self.reference))
    return b2
1137910
public BlockLocation[] locationsFor(FileStatus stat, long start, long len)
      throws IOException {
    // TODO cache
    return fs.getFileBlockLocations(stat, start, len);
  }
445552
public static List<Path> getSubPathList(Path startDirectoryPath,
			int maxDepth) {
		return getSubPathList(startDirectoryPath, maxDepth,
				JMPredicate.getTrue());
	}
377692
public static LocatedBlockFileStatus toLocatedBlockFileStatus(HdfsFileStatus stat,
      LocatedBlocks locs, String src) {
    if (stat == null) {
      return null;
    }
    return new LocatedBlockFileStatus(stat.getLen(),
        stat.isDir(), stat.getReplication(),
        stat.getBlockSize(), stat.getModificationTime(),
        stat.getAccessTime(),
        stat.getPermission(), stat.getOwner(), stat.getGroup(),
        stat.getFullPath(new Path(src)), // full path
        DFSUtil.locatedBlocks2BlockLocations(locs),
        locs.isUnderConstruction());
  }