gpt4 book ai didi

org.openstreetmap.osmosis.xml.v0_6.XmlChangeWriter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 15:57:05 27 4
gpt4 key购买 nike

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

XmlChangeWriter介绍

[英]An OSM change sink for storing all data to an xml file.
[中]OSM变更接收器,用于将所有数据存储到xml文件中。

代码示例

代码示例来源:origin: openstreetmap/osmosis

@Override
  public XmlChangeWriter saveData(long sequence) {
    File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz");
    return new XmlChangeWriter(changeFile, CompressionMethod.GZip);
  }
}

代码示例来源:origin: openstreetmap/osmosis

@Override
public void process(ChangeContainer change) {
  changeWriter.process(change);
}

代码示例来源:origin: openstreetmap/osmosis

@Override
  public void close() {
    if (changeWriter != null) {
      changeWriter.close();
      changeWriter = null;
    }
    stateWriter.close();
  }
}

代码示例来源:origin: org.locationtech.geogig/geogig-osm

/**
 * Executes the command with the specified options.
 */
@Override
protected void runInternal(GeogigCLI cli) throws IOException {
  checkParameter(refSpec.size() < 3, "Commit list is too long :" + refSpec);
  GeoGIG geogig = cli.getGeogig();
  CreateOSMChangesetOp op = geogig.command(CreateOSMChangesetOp.class);
  String oldVersion = resolveOldVersion();
  String newVersion = resolveNewVersion();
  op.setOldVersion(oldVersion).setNewVersion(newVersion).setId(id);
  try (AutoCloseableIterator<ChangeContainer> entries = op
      .setProgressListener(cli.getProgressListener()).call()) {
    if (!entries.hasNext()) {
      cli.getConsole().println("No differences found");
      return;
    }
    BufferedWriter bufWriter = new BufferedWriter(new FileWriter(new File(file)));
    XmlChangeWriter writer = new XmlChangeWriter(bufWriter);
    while (entries.hasNext()) {
      ChangeContainer change = entries.next();
      writer.process(change);
    }
    writer.complete();
    bufWriter.flush();
  }
}

代码示例来源:origin: openstreetmap/osmosis

@Override
public void complete() {
  if (state.getSequenceNumber() > 0) {
    // Complete the writing of the change file.
    changeWriter.complete();
    changeWriter.close();
    changeWriter = null;
  }
  // Write the sequenced state file.
  replicationStore.saveState(state);
  // We must only complete the state writer after we've finished writing
  // the replication data and sequence numbered state.
  stateWriter.complete();
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * {@inheritDoc}
 */
public void process(ChangeContainer changeContainer) {
  initialize();
  
  osmChangeWriter.process(changeContainer);
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

@Override
public void complete() {
  if (state.getSequenceNumber() > 0) {
    // Complete the writing of the change file.
    changeWriter.complete();
    changeWriter.close();
    changeWriter = null;
  }
  // Write the sequenced state file.
  replicationStore.saveState(state);
  // We must only complete the state writer after we've finished writing
  // the replication data and sequence numbered state.
  stateWriter.complete();
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

/**
 * {@inheritDoc}
 */
public void process(ChangeContainer changeContainer) {
  initialize();
  
  osmChangeWriter.process(changeContainer);
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

@Override
  public XmlChangeWriter saveData(long sequence) {
    File changeFile = sequenceFormatter.getFormattedName(sequence, ".osc.gz");
    return new XmlChangeWriter(changeFile, CompressionMethod.GZip);
  }
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

@Override
public void process(ChangeContainer change) {
  changeWriter.process(change);
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-replication

@Override
  public void close() {
    if (changeWriter != null) {
      changeWriter.close();
      changeWriter = null;
    }
    stateWriter.close();
  }
}

代码示例来源:origin: openstreetmap/osmosis

/**
   * {@inheritDoc}
   */
  @Override
  protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    String fileName;
    File file;
    CompressionMethod compressionMethod;
    XmlChangeWriter task;
    
    // Get the task arguments.
    fileName = getStringArgument(
      taskConfig,
      ARG_FILE_NAME,
      getDefaultStringArgument(taskConfig, DEFAULT_FILE_NAME)
    );
    compressionMethod = getCompressionMethodArgument(taskConfig, fileName);
    
    // Create a file object from the file name provided.
    file = new File(fileName);
    
    // Build the task object.
    task = new XmlChangeWriter(file, compressionMethod);
    
    return new ChangeSinkManager(taskConfig.getId(), task, taskConfig.getPipeArgs());
  }
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

/**
   * {@inheritDoc}
   */
  @Override
  protected TaskManager createTaskManagerImpl(TaskConfiguration taskConfig) {
    String fileName;
    File file;
    CompressionMethod compressionMethod;
    XmlChangeWriter task;
    
    // Get the task arguments.
    fileName = getStringArgument(
      taskConfig,
      ARG_FILE_NAME,
      getDefaultStringArgument(taskConfig, DEFAULT_FILE_NAME)
    );
    compressionMethod = getCompressionMethodArgument(taskConfig, fileName);
    
    // Create a file object from the file name provided.
    file = new File(fileName);
    
    // Build the task object.
    task = new XmlChangeWriter(file, compressionMethod);
    
    return new ChangeSinkManager(taskConfig.getId(), task, taskConfig.getPipeArgs());
  }
}

代码示例来源:origin: openstreetmap/osmosis

writer = new XmlChangeWriter(tmpFile, CompressionMethod.GZip);

代码示例来源:origin: openstreetmap/osmosis

/**
 * Tests acceptance of nodes in a delete change with lat/lon attribute not set.
 * 
 * @throws Exception if something goes wrong.
 */
@Test
public void testDeleteLatLonNotSet() throws Exception {
  XmlChangeReader xmlReader;
  XmlChangeWriter xmlWriter;
  File inputFile;
  File outputFile;
  
  inputFile = dataUtils.createDataFile("v0_6/xml-delete-no-coordinates.osc");
  outputFile = dataUtils.newFile();
  
  // Create and connect the xml tasks.
  xmlReader = new XmlChangeReader(inputFile, true, CompressionMethod.None);
  xmlWriter = new XmlChangeWriter(outputFile, CompressionMethod.None);
  xmlReader.setChangeSink(xmlWriter);
  
  // Process the xml.
  xmlReader.run();
  
  // Validate that the output file matches the input file.
  dataUtils.compareFiles(inputFile, outputFile);
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * A basic test reading and writing an osm file testing both reader and
 * writer tasks.
 * 
 * @throws IOException
 *             if any file operations fail.
 */
@Test
public void testSimple() throws IOException {
  XmlChangeReader xmlReader;
  XmlChangeWriter xmlWriter;
  File inputFile;
  File outputFile;
  
  inputFile = dataUtils.createDataFile("v0_6/xml-task-tests-v0_6.osc");
  outputFile = dataUtils.newFile();
  
  // Create and connect the xml tasks.
  xmlReader = new XmlChangeReader(inputFile, true, CompressionMethod.None);
  xmlWriter = new XmlChangeWriter(outputFile, CompressionMethod.None);
  xmlReader.setChangeSink(xmlWriter);
  
  // Process the xml.
  xmlReader.run();
  
  // Validate that the output file matches the input file.
  dataUtils.compareFiles(inputFile, outputFile);
}

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