gpt4 book ai didi

org.archive.format.gzip.zipnum.ZipNumIndex类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:30:00 28 4
gpt4 key购买 nike

本文整理了Java中org.archive.format.gzip.zipnum.ZipNumIndex类的一些代码示例,展示了ZipNumIndex类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipNumIndex类的具体详情如下:
包路径:org.archive.format.gzip.zipnum.ZipNumIndex
类名称:ZipNumIndex

ZipNumIndex介绍

暂无

代码示例

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public static ZipNumIndex createIndexWithBasePath(String pathRoot) throws IOException
{
  ZipNumIndex zipIndex = new ZipNumIndex();
  zipIndex.setPathRoot(pathRoot);
  zipIndex.init();
  return zipIndex;
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public CloseableIterator<String> getLastBlockCDXLineIterator(String key) throws IOException {
  // the next line after last key<space> is key! so this will return last key<space> block
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(endKey(key));
  
  return wrapStartIterator(getCDXIterator(summaryIter), key);
}

代码示例来源:origin: org.netpreserve.commons/commons-web

public int getNumLines(String[] blocks)
{
  if (blocks.length < 2) {
    return 0;
  }
  
  int lastLine = -1;
  int line = -1;
  
  int size = 0;
  
  for (String block : blocks) {
    lastLine = line;
    line = extractLineCount(block);
      
    if (lastLine >= 0) {
      size += (line - lastLine);
    }
  }
  
  return size;
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public static CloseableIterator<String> wrapPrefix(CloseableIterator<String> source, String prefix, boolean exact)
{
  if (exact) {
    return wrapEndIterator(source, endKey(prefix), false);
  } else {
    return wrapEndIterator(source, prefix, true);
  }
}

代码示例来源:origin: iipc/webarchive-commons

public static ZipNumIndex createIndexWithSummaryPath(String summaryFile) throws IOException
{
  ZipNumIndex zipIndex = new ZipNumIndex();
  zipIndex.setSummaryFile(summaryFile);
  zipIndex.init();
  return zipIndex;
}

代码示例来源:origin: org.netpreserve.commons/commons-web

public CloseableIterator<String> getCDXIterator(String key, String start, String end, ZipNumParams params) throws IOException {	
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(key);
  
  if (params.getTimestampDedupLength() > 0) {
    summaryIter = new TimestampDedupIterator(summaryIter, params.getTimestampDedupLength());
  }
  
  if (end != null && !end.isEmpty()) {
    summaryIter = wrapEndIterator(summaryIter, end, false);
  }
  
  if (blockLoader.isBufferFully() && (params != null) && (params.getMaxBlocks() > 0)) {
    LineBufferingIterator lineBufferIter = new LineBufferingIterator(summaryIter, params.getMaxBlocks(), params.isReverse());
    lineBufferIter.bufferInput();
    summaryIter = lineBufferIter;
  }
  
  if (params.isReverse()) {
    return wrapReverseIterator(getCDXIterator(summaryIter, params), start, endKey(key));
  } else {
    return wrapStartEndIterator(getCDXIterator(summaryIter, params), start, end, false);
  }
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public PageResult getNthPage(String[] startEnd, int page, int pageSize, boolean numPagesOnly) throws IOException
  String startEndIdx[] = getSummary().getRange(startEnd[0], startEnd[1]);
  int firstLineNumber = extractLineCount(startEndIdx[0]);
  int endLineNumber = extractLineCount(startEndIdx[1]) + 1;
  int totalLines = endLineNumber - firstLineNumber;
    startEndIdx[0] = getNthLine("" + firstPageLineNumber, LINE_COUNT_FIELD);
    startEndIdx[1] = getNthLine("" + lastPageLineNumber, LINE_COUNT_FIELD);
  } else {
    endInclusive = true;
  CloseableIterator<String> blocklines = getClusterRange(startEndIdx[0], startEndIdx[1], endInclusive, false);
  return new PageResult(blocklines, numPages);

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public CloseableIterator<String> getCDXIterator(CloseableIterator<String> summaryIterator, String start, String end, int split, int numSplits, ZipNumParams params)	
{
  CloseableIterator<String> blocklines = this.getCDXIterator(summaryIterator, params);
  
  if ((split == 0) && (start != null) && !start.isEmpty()) {
    blocklines = wrapStartIterator(blocklines, start);
  }
  
  if ((split >= (numSplits - 1)) && (end != null) && !end.isEmpty()) {
    blocklines = wrapEndIterator(blocklines, end, false);
  }
  
  return blocklines;
}

代码示例来源:origin: iipc/webarchive-commons

public CloseableIterator<String> getCDXIterator(String key, String start, boolean exact, ZipNumParams params) throws IOException {
  
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(key);
  
  if (params.getTimestampDedupLength() > 0) {
    summaryIter = new TimestampDedupIterator(summaryIter, params.getTimestampDedupLength());
  }
  
  summaryIter = wrapPrefix(summaryIter, start, exact);
  
  if (blockLoader.isBufferFully() && (params != null) && (params.getMaxBlocks() > 0)) {
    LineBufferingIterator lineBufferIter = new LineBufferingIterator(summaryIter, params.getMaxBlocks(), params.isReverse());
    lineBufferIter.bufferInput();
    summaryIter = lineBufferIter;
  }
  
  return wrapStartIterator(getCDXIterator(summaryIter, params), start);
}

代码示例来源:origin: org.netpreserve.commons/commons-web

SeekableLineReader currReader = zipnumIndex.doBlockLoad(currPartId, startOffset, totalLength);
if ((currReader == null) && zipnumIndex.isRequired()) {
  throw new RuntimeIOException("Failed to load shards for: " + currPartId);
CloseableIterator<String> slrIter = new SeekableLineReaderIterator(currReader, zipnumIndex.isRequired());
  slrIter = new LineBufferingIterator(slrIter, zipnumIndex.getCdxLinesPerBlock(), true);

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public CloseableIterator<String> getCDXIterator(CloseableIterator<String> summaryIterator, String start, String end, int split, int numSplits)	
{
  return getCDXIterator(summaryIterator, start, end, split, numSplits, null);
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public CloseableIterator<String> getCDXIterator(String key, ZipNumParams params) throws IOException {
  
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(key);        
  return wrapStartIterator(getCDXIterator(summaryIter, params), key);
}

代码示例来源:origin: iipc/webarchive-commons

public long getTotalLength(String[] blocks)
{    
  long size = 0;
  
  for (String block : blocks) {
    size += extractLongField(block, 3);
  }
  
  return size;
}

代码示例来源:origin: org.netpreserve.commons/commons-web

public void setCdxUris(List<String> cdxUris) throws IOException {
  cdx = new ArrayList<CDXInputSource>();
  
  for (String uri : cdxUris) {
    if (uri.endsWith(".cdx") || uri.endsWith(".cdx.gz")) {
      cdx.add(new CDXFile(uri));
    } else if (uri.endsWith("ALL.summary") && uri.contains("/")) {
      cdx.add(ZipNumIndex.createIndexWithSummaryPath(uri));
    } else {
      //Skipping?
    }
  }
}

代码示例来源:origin: iipc/webarchive-commons

public CloseableIterator<String> getCDXIterator(String key, String start, String end, ZipNumParams params) throws IOException {	
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(key);
  
  if (params.getTimestampDedupLength() > 0) {
    summaryIter = new TimestampDedupIterator(summaryIter, params.getTimestampDedupLength());
  }
  
  if (end != null && !end.isEmpty()) {
    summaryIter = wrapEndIterator(summaryIter, end, false);
  }
  
  if (blockLoader.isBufferFully() && (params != null) && (params.getMaxBlocks() > 0)) {
    LineBufferingIterator lineBufferIter = new LineBufferingIterator(summaryIter, params.getMaxBlocks(), params.isReverse());
    lineBufferIter.bufferInput();
    summaryIter = lineBufferIter;
  }
  
  if (params.isReverse()) {
    return wrapReverseIterator(getCDXIterator(summaryIter, params), start, endKey(key));
  } else {
    return wrapStartEndIterator(getCDXIterator(summaryIter, params), start, end, false);
  }
}

代码示例来源:origin: iipc/webarchive-commons

public PageResult getNthPage(String[] startEnd, int page, int pageSize, boolean numPagesOnly) throws IOException
  String startEndIdx[] = getSummary().getRange(startEnd[0], startEnd[1]);
  int firstLineNumber = extractLineCount(startEndIdx[0]);
  int endLineNumber = extractLineCount(startEndIdx[1]) + 1;
  int totalLines = endLineNumber - firstLineNumber;
    startEndIdx[0] = getNthLine("" + firstPageLineNumber, LINE_COUNT_FIELD);
    startEndIdx[1] = getNthLine("" + lastPageLineNumber, LINE_COUNT_FIELD);
  } else {
    endInclusive = true;
  CloseableIterator<String> blocklines = getClusterRange(startEndIdx[0], startEndIdx[1], endInclusive, false);
  return new PageResult(blocklines, numPages);

代码示例来源:origin: org.netpreserve.commons/commons-web

public CloseableIterator<String> getCDXIterator(CloseableIterator<String> summaryIterator, String start, String end, int split, int numSplits, ZipNumParams params)	
{
  CloseableIterator<String> blocklines = this.getCDXIterator(summaryIterator, params);
  
  if ((split == 0) && (start != null) && !start.isEmpty()) {
    blocklines = wrapStartIterator(blocklines, start);
  }
  
  if ((split >= (numSplits - 1)) && (end != null) && !end.isEmpty()) {
    blocklines = wrapEndIterator(blocklines, end, false);
  }
  
  return blocklines;
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public static ZipNumIndex createIndexWithSummaryPath(String summaryFile) throws IOException
{
  ZipNumIndex zipIndex = new ZipNumIndex();
  zipIndex.setSummaryFile(summaryFile);
  zipIndex.init();
  return zipIndex;
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

public CloseableIterator<String> getCDXIterator(String key, String start, boolean exact, ZipNumParams params) throws IOException {
  
  CloseableIterator<String> summaryIter = summary.getRecordIteratorLT(key);
  
  if (params.getTimestampDedupLength() > 0) {
    summaryIter = new TimestampDedupIterator(summaryIter, params.getTimestampDedupLength());
  }
  
  summaryIter = wrapPrefix(summaryIter, start, exact);
  
  if (blockLoader.isBufferFully() && (params != null) && (params.getMaxBlocks() > 0)) {
    LineBufferingIterator lineBufferIter = new LineBufferingIterator(summaryIter, params.getMaxBlocks(), params.isReverse());
    lineBufferIter.bufferInput();
    summaryIter = lineBufferIter;
  }
  
  return wrapStartIterator(getCDXIterator(summaryIter, params), start);
}

代码示例来源:origin: org.netpreserve.commons/webarchive-commons

SeekableLineReader currReader = zipnumIndex.doBlockLoad(currPartId, startOffset, totalLength);
if ((currReader == null) && zipnumIndex.isRequired()) {
  throw new RuntimeIOException("Failed to load shards for: " + currPartId);
CloseableIterator<String> slrIter = new SeekableLineReaderIterator(currReader, zipnumIndex.isRequired());
  slrIter = new LineBufferingIterator(slrIter, zipnumIndex.getCdxLinesPerBlock(), true);

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com