Get block locations within the specified range.

@see ClientProtocol#getBlockLocations(String, long, long)
510093
public LocatedBlocks getBlockLocations(String src, long offset, long length) throws IOException {
    INode[] inodes = dir.getExistingPathINodes(src);
    return getBlockLocations(src, inodes[inodes.length-1],
        offset, length, false, BlockMetaInfoType.NONE);
  }
1305146
def load_blocks(self, location, blocks, ranges, query):
        
        if (logging.getLogger().getEffectiveLevel() <= logging.DEBUG):
            msg = 'Loading {b.count} blocks from {loc}:{b.offset}+{b.length}'
            logging.debug(msg.format(b=blocks, loc=location))

        reader = self.blk_loader.load(location, blocks.offset, blocks.length)

        def decompress_block(range_):
            decomp = gzip_decompressor()
            buff = decomp.decompress(reader.read(range_))
            for line in BytesIO(buff):
                yield line

        def iter_blocks(reader):
            try:
                for r in ranges:
                    yield decompress_block(r)
            finally:
                reader.close()

        # iterate over all blocks
        iter_ = itertools.chain.from_iterable(iter_blocks(reader))

        # start bound
        iter_ = linearsearch(iter_, query.key)

        # end bound
        iter_ = itertools.takewhile(lambda line: line < query.end_key, iter_)
        return iter_
1194603
private static int getBlockIdInFile(DistributedFileSystem srcFs, 
      Path srcPath, long blockId) throws IOException {
    FileStatus srcStat = srcFs.getFileStatus(srcPath);
    LocatedBlocks lbs =
        srcFs.getClient().getLocatedBlocks(srcPath.toUri().getPath(), 0, 
            srcStat.getLen());
    
    int i = 0;
    LOG.info("Look for block " + blockId + " in file " + srcPath);
    for (LocatedBlock lb: lbs.getLocatedBlocks()) {
      if (lb.getBlock().getBlockId() == blockId) {
        return i;
      }
      i++;
    }
    
    return -1;
  }
1098084
public synchronized List<Message> getFromRange(final int startPosition, final int endPosition) {
        // cache this here, so all parts of the method operate on the same data
        final int firstMessageId = this.getFirstPosition();
        // input validation
        if ((startPosition < MessageStore.INITIAL_MESSAGE_POSITION)
                || (endPosition < MessageStore.INITIAL_MESSAGE_POSITION)) {
            throw new IllegalArgumentException("Message position cannot be negative.");
        } else if ((firstMessageId >= MessageStore.INITIAL_MESSAGE_POSITION) && (startPosition < firstMessageId)) {
            throw new IllegalArgumentException("Message at position " + startPosition
                    + " had already been discarded. First available message position is " + firstMessageId + ".");
        } else if (endPosition <= startPosition) {
            throw new IllegalArgumentException("Ending position must be larger than starting message position.");
        } else if (endPosition > this.getNextPosition()) {
            throw new IllegalArgumentException("Range end cannot be greater than the next message position.");
        }
        // and properly synchronized range retrieval
        return Collections.unmodifiableList(new LinkedList<>(this.store.subMap(startPosition, endPosition)
                .values()));
    }
626232
public List<MasterBlockLocation> getBlockLocations() {
    List<MasterBlockLocation> ret = new ArrayList<>(mWorkerIdToAlias.size());
    for (Map.Entry<Long, String> entry : mWorkerIdToAlias.entrySet()) {
      ret.add(new MasterBlockLocation(entry.getKey(), entry.getValue()));
    }
    return ret;
  }
68937
protected static <R extends IPAddressSection> R[] getSpanningPrefixBlocks(
			R first,
			R other,
			UnaryOperator<R> getLower,
			UnaryOperator<R> getUpper,
			Comparator<R> comparator,
			UnaryOperator<R> prefixAdder,
			UnaryOperator<R> prefixRemover,
			IntFunction<R[]> arrayProducer) {
		first.checkSectionCount(other);
		R[] result = checkPrefixBlockContainment(first, other, prefixAdder, arrayProducer);
		if(result != null) {
			return result;
		}
		List<IPAddressSegmentSeries> blocks = getSpanningBlocks(first, other, getLower, getUpper, comparator, prefixRemover, IPAddressSection::splitIntoPrefixBlocks);
		result = blocks.toArray(arrayProducer.apply(blocks.size()));
		return result;
	}
196579
@Override
	public int getMinPrefixLengthForBlock() {
		int count = getDivisionCount();
		int totalPrefix = getBitCount();
		for(int i = count - 1; i >= 0 ; i--) {
			AddressDivisionBase div = getDivision(i);
			int segBitCount = div.getBitCount();
			int segPrefix = div.getMinPrefixLengthForBlock();
			if(segPrefix == segBitCount) {
				break;
			} else {
				totalPrefix -= segBitCount;
				if(segPrefix != 0) {
					totalPrefix += segPrefix;
					break;
				}
			}
		}
		return totalPrefix;
	}
236646
public List<Jid> getBlockList()
            throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {

        if (blockListCached == null) {
            BlockListIQ blockListIQ = new BlockListIQ();
            BlockListIQ blockListIQResult = connection().createStanzaCollectorAndSend(blockListIQ).nextResultOrThrow();
            blockListCached = blockListIQResult.getBlockedJidsCopy();
        }

        return Collections.unmodifiableList(blockListCached);
    }
132206
public static long getPosFromBlockOffset(long offsetInBlock, int bytesPerChecksum,
      int checksumSize) {
    // We only support to read full chunks, so offsetInBlock must be the boundary
    // of the chunks.
    assert offsetInBlock % bytesPerChecksum == 0;
    // The position in the file will be the same as the file size for the block
    // size.
    return getFileLengthFromBlockSize(offsetInBlock, bytesPerChecksum, checksumSize);
  }
238346
function getBlockNodes(nodes) {
  // TODO(perf): update `nodes` instead of creating a new object?
  var node = nodes[0];
  var endNode = nodes[nodes.length - 1];
  var blockNodes;

  for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
    if (blockNodes || nodes[i] !== node) {
      if (!blockNodes) {
        blockNodes = jqLite(slice.call(nodes, 0, i));
      }
      blockNodes.push(node);
    }
  }

  return blockNodes || nodes;
}
520951
public GetAnyLocationsResponse getAnyLocations(String region) throws ApiException {
        ApiResponse<GetAnyLocationsResponse> resp = getAnyLocationsWithHttpInfo(region);
        return resp.getData();
    }
781340
private LocatedBlocks createLocatedBlocks(INode node) throws IOException {
     LocatedBlocks loc = null;
     if (node instanceof INodeFile) {
       loc = getFSNamesystem().getBlockLocationsInternal(
           (INodeFile)node, 0L, Long.MAX_VALUE, Integer.MAX_VALUE);
     }
     if (loc==null) {
       loc = EMPTY_BLOCK_LOCS;
     }
     return loc;
   }
1172478
public java.util.List<String> getCheckerIpRanges() {
        if (checkerIpRanges == null) {
            checkerIpRanges = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return checkerIpRanges;
    }
92657
public Collection<Location> getLocationsContainingInstructionWithOffset(int offset) {
        LinkedList<Location> result = new LinkedList<>();
        for (Iterator<Location> i = locationIterator(); i.hasNext();) {
            Location location = i.next();
            if (location.getHandle().getPosition() == offset) {
                result.add(location);
            }
        }
        return result;
    }
774820
public Set<String> getBlockingLockedResources() {

        Set<String> blockingResources = new HashSet<String>();
        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            try {
                blockingResources.addAll(getCms().getLockedResources(resName, getBlockingFilter()));
            } catch (CmsException e) {
                // error reading a resource, should usually never happen
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            if (Boolean.valueOf(getParamIncluderelated()).booleanValue()) {
                addLockedRelatedResources(resName, getBlockingFilter(), blockingResources);
            }
        }
        m_blockingLocks = blockingResources.size();
        return blockingResources;
    }
872435
public java.util.List<TargetLocation> getTargetLocations() {
        if (targetLocations == null) {
            targetLocations = new com.amazonaws.internal.SdkInternalList<TargetLocation>();
        }
        return targetLocations;
    }
859702
private function getAddressRange($netblock)
    {
        $t = explode('/', $netblock);
        $addr = $t[0];
        $cidr = $t[1];

        $corr=( pow(2, 32) - 1)-(pow(2, 32 - $cidr) - 1 );
        $first=ip2long($addr) & ($corr);
        $length=pow(2, 32 - $cidr) - 1;

        return [
            'begin'  => $first,
            'end'   => $first + $length,
        ];

    }