Esempio n. 1
0
    public BlockRead getCachedMetaBlock(String blockName) throws IOException {
      String _lookup = fileName + "M" + blockName;

      if (_iCache != null) {
        CacheEntry cacheEntry = _iCache.getBlock(_lookup);

        if (cacheEntry != null) {
          return new CachedBlockRead(cacheEntry, cacheEntry.getBuffer());
        }
      }

      return null;
    }
Esempio n. 2
0
    private BlockRead getBlock(String _lookup, BlockCache cache, BlockLoader loader)
        throws IOException {

      BlockReader _currBlock;

      if (cache != null) {
        CacheEntry cb = null;
        cb = cache.getBlock(_lookup);

        if (cb != null) {
          return new CachedBlockRead(cb, cb.getBuffer());
        }
      }
      /** grab the currBlock at this point the block is still in the data stream */
      _currBlock = loader.get();

      /** If the block is bigger than the cache just return the stream */
      return cacheBlock(_lookup, cache, _currBlock, loader.getInfo());
    }