Package org.archive.wayback.util.flatfile

Examples of org.archive.wayback.util.flatfile.FlatFile



  private boolean mergeFile(File cdxFile) {
    boolean added = false;
    try {
      FlatFile ffile = new FlatFile(cdxFile.getAbsolutePath());
      AdaptedIterator<String,SearchResult> searchResultItr =
        new AdaptedIterator<String,SearchResult>(
            ffile.getSequentialIterator(),
          new CDXLineToSearchResultAdapter());
      Iterator<BDBRecord> it = new AdaptedIterator<SearchResult,BDBRecord>
        (searchResultItr,new SearchResultToBDBRecordAdapter());

      index.insertRecords(it);
View Full Code Here


    canonicalizer = new AggressiveUrlCanonicalizer();
  }
 
  @SuppressWarnings("unchecked")
  private void reloadMapFile() throws IOException {
    FlatFile ff = new FlatFile(mapPath);
    Iterator itr = ff.getSequentialIterator();
    HashMap<String,RangeGroup> newGroupsMap =
      new HashMap<String,RangeGroup>();
    HashMap<String,RangeGroup> oldGroupsMap =
      new HashMap<String,RangeGroup>();
   
View Full Code Here

      e.printStackTrace();
    }
  }
  protected Map<String,Object> loadFile(String path) throws IOException {
    Map<String, Object> newMap = new HashMap<String, Object>();
    FlatFile ff = new FlatFile(path);
    CloseableIterator<String> itr = ff.getSequentialIterator();
    while(itr.hasNext()) {
      String line = (String) itr.next();
      line = line.trim();
      if(line.length() == 0) {
        continue;
View Full Code Here

          e.getLocalizedMessage());
    }
  }
  protected TreeSet<String> loadFile(String path) throws IOException {
    TreeSet<String> excludes = new TreeSet<String>();
    FlatFile ff = new FlatFile(path);
    CloseableIterator<String> itr = ff.getSequentialIterator();
    while(itr.hasNext()) {
      String line = (String) itr.next();
      line = line.trim();
      if(line.length() == 0) {
        continue;
View Full Code Here

          e.getLocalizedMessage());
    }
  }
  protected Map<String,Object> loadFile(String path) throws IOException {
    Map<String, Object> newMap = new HashMap<String, Object>();
    FlatFile ff = new FlatFile(path);
    CloseableIterator<String> itr = ff.getSequentialIterator();
    while(itr.hasNext()) {
      String line = (String) itr.next();
      line = line.trim();
     
      if (line.length() == 0) {
View Full Code Here

  public Iterator<ResourceFileLocation> iterator() {
    return files.values().iterator();
  }

  public void store(File target) throws IOException {
    FlatFile ff = new FlatFile(target.getAbsolutePath());
    Iterator<String> adapted =
      new AdaptedIterator<ResourceFileLocation,String>(iterator(),
        new ResourceFileLocationAdapter());
    ff.store(adapted);
  }
View Full Code Here

  }

  public static ResourceFileList load(File source) throws IOException {
    ResourceFileList list = new ResourceFileList();
   
    FlatFile ff = new FlatFile(source.getAbsolutePath());
    CloseableIterator<String> itr = ff.getSequentialIterator();
    while(itr.hasNext()) {
      String line = itr.next();
      ResourceFileLocation location =
        ResourceFileLocation.deserializeLine(line);
      if(location != null) {
View Full Code Here

    canonicalizer = new AggressiveUrlCanonicalizer();
  }
 
  @SuppressWarnings("unchecked")
  private void reloadMapFile() throws IOException {
    FlatFile ff = new FlatFile(mapPath);
    Iterator itr = ff.getSequentialIterator();
    HashMap<String,RangeGroup> newGroupsMap =
      new HashMap<String,RangeGroup>();
    HashMap<String,RangeGroup> oldGroupsMap =
      new HashMap<String,RangeGroup>();
   
View Full Code Here

  /**
   * @param path the path to set
   */
  public void setPath(String path) {
    this.path = path;
    flatFile = new FlatFile(path);
  }
View Full Code Here

  public ZiplinesSearchResultSource(CDXFormat format) {
    this.format = format;
  }
  public void init() throws IOException {
    chunkMap = new HashMap<String, BlockLocation>();
    FlatFile ff = new FlatFile(chunkMapPath);
    CloseableIterator<String> lines = ff.getSequentialIterator();
    while(lines.hasNext()) {
      String line = lines.next();
      String[] parts = line.split("\\s");
      if(parts.length < 2) {
        LOGGER.severe("Bad line(" + line +") in (" +
            chunkMapPath + ")");
        throw new IOException("Bad line(" + line +") in (" +
            chunkMapPath + ")");
      }
     
      String locations[] = new String[parts.length - 1];
      for(int i = 1; i < parts.length; i++) {
        locations[i-1] = parts[i];
      }
      BlockLocation bl = new BlockLocation(parts[0], locations);
      chunkMap.put(parts[0],bl);
    }
    lines.close();
    chunkIndex = new FlatFile(chunkIndexPath);
  }
View Full Code Here

TOP

Related Classes of org.archive.wayback.util.flatfile.FlatFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.