本文整理汇总了Java中org.openstreetmap.osmosis.xml.common.CompressionMethod类的典型用法代码示例。如果您正苦于以下问题:Java CompressionMethod类的具体用法?Java CompressionMethod怎么用?Java CompressionMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompressionMethod类属于org.openstreetmap.osmosis.xml.common包,在下文中一共展示了CompressionMethod类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readOsmXml
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
public static OsmXmlLoader readOsmXml(File osmxml) {
// Defines the interface for tasks consuming OSM data types.
OsmXmlLoader sink = new OsmXmlLoader();
// compression (if any)
CompressionMethod compression = CompressionMethod.None;
if (osmxml.getName().endsWith(".gz")) {
compression = CompressionMethod.GZip;
} else if (osmxml.getName().endsWith(".bz2")) {
compression = CompressionMethod.BZip2;
}
// read source file (into sink)
XmlReader reader = new XmlReader(osmxml, false, compression);
reader.setSink(sink);
reader.run(); // just run, no threading
return sink;
}
开发者ID:ngageoint,项目名称:geowave-osm,代码行数:21,代码来源:OsmXmlLoader.java
示例2: writeOsm
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
/**
* @param data the map to write
*/
public void writeOsm(final IDataSet data) {
DataSetSource source = new DataSetSource(data);
CompressionMethod compr = CompressionMethod.None;
if (myFileName.getName().toLowerCase().endsWith(".gz")) {
compr = CompressionMethod.GZip;
} else {
if (myFileName.getName().toLowerCase().endsWith(".bz2")) {
compr = CompressionMethod.BZip2;
}
}
XmlWriter task = new XmlWriter(this.myFileName, compr);
source.setSink(task);
task.release();
}
开发者ID:xafero,项目名称:travelingsales,代码行数:20,代码来源:FileWriter.java
示例3: readOsmXml
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
public static SimpleOsmDump readOsmXml(File osmxml) {
// Defines the interface for tasks consuming OSM data types.
SimpleOsmDump sink = new SimpleOsmDump();
// compression (if any)
CompressionMethod compression = CompressionMethod.None;
if (osmxml.getName().endsWith(".gz")) {
compression = CompressionMethod.GZip;
} else if (osmxml.getName().endsWith(".bz2")) {
compression = CompressionMethod.BZip2;
}
// read source file (into sink)
XmlReader reader = new XmlReader(osmxml, false, compression);
reader.setSink(sink);
reader.run(); // just run, no threading
return sink;
}
开发者ID:klamann,项目名称:maps4cim,代码行数:21,代码来源:SimpleOsmDump.java
示例4: parseOsmChange
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
/**
* @param sink where to give the file-content for processing
*/
public void parseOsmChange(final ChangeSink sink) {
CompressionMethod compr = CompressionMethod.None;
if (myFileName.getName().toLowerCase().endsWith(".gz")) {
compr = CompressionMethod.GZip;
} else {
if (myFileName.getName().toLowerCase().endsWith(".bz2")) {
compr = CompressionMethod.BZip2;
}
}
XmlChangeReader task = new XmlChangeReader(this.myFileName, true, compr);
task.setChangeSink(sink);
try {
task.run();
} catch (java.lang.NumberFormatException e) {
if (e.getMessage().equals("null")) {
// this seems to be an api0.5-file.
org.openstreetmap.osmosis.xml.v0_6.XmlChangeReader oldTask = new org.openstreetmap.osmosis.xml.v0_6.XmlChangeReader(this.myFileName, true, compr);
/*MigrateChangeV05ToV06 migrate = new MigrateChangeV05ToV06();
migrate.setChangeSink(sink);
oldTask.setChangeSink(migrate);*/ // TODO: Check migrate!
oldTask.run();
} else {
throw e;
}
}
}
开发者ID:xafero,项目名称:travelingsales,代码行数:32,代码来源:FileLoader.java
示例5: readOsmXml
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
public static OsmXmlLoader readOsmXml(
File osmxml ) {
// Defines the interface for tasks consuming OSM data types.
OsmXmlLoader sink = new OsmXmlLoader();
// compression (if any)
CompressionMethod compression = CompressionMethod.None;
if (osmxml.getName().endsWith(
".gz")) {
compression = CompressionMethod.GZip;
}
else if (osmxml.getName().endsWith(
".bz2")) {
compression = CompressionMethod.BZip2;
}
// read source file (into sink)
XmlReader reader = new XmlReader(
osmxml,
false,
compression);
reader.setSink(sink);
reader.run(); // just run, no threading
return sink;
}
开发者ID:locationtech,项目名称:geowave,代码行数:28,代码来源:OsmXmlLoader.java
示例6: parseOsm
import org.openstreetmap.osmosis.xml.common.CompressionMethod; //导入依赖的package包/类
/**
* @param sink where to give the file-content for processing
*/
public void parseOsm(final Sink sink) {
if (this.myFileName.getName().contains(".osc") && (sink instanceof ChangeSink)) {
parseOsmChange((ChangeSink) sink);
return;
}
CompressionMethod compr = CompressionMethod.None;
if (myFileName.getName().toLowerCase().endsWith(".gz")) {
compr = CompressionMethod.GZip;
} else {
if (myFileName.getName().toLowerCase().endsWith(".bz2")) {
compr = CompressionMethod.BZip2;
}
}
XmlReader task = new XmlReader(this.myFileName, true, compr);
//EntityBuffer buffer = new EntityBuffer(BUFFERCAPACITY);
//task.setSink(buffer);
//buffer.setSink(sink);
task.setSink(sink);
try {
// buffer.run();
task.run();
} catch (java.lang.NumberFormatException e) {
if (e.getMessage().equals("null")) {
// this seems to be an api0.5-file.
org.openstreetmap.osmosis.xml.v0_6.XmlReader oldTask = new org.openstreetmap.osmosis.xml.v0_6.XmlReader(this.myFileName, true, compr);
/*MigrateV05ToV06 migrate = new MigrateV05ToV06();
oldTask.setSink(migrate);*/ // TODO: Check migrate!
// buffer = new EntityBuffer(BUFFERCAPACITY);
// migrate.setSink(buffer);
/*migrate.setSink(sink);*/
// buffer.setSink(sink);
// buffer.run();
oldTask.run();
} else {
throw e;
}
}
}
开发者ID:xafero,项目名称:travelingsales,代码行数:46,代码来源:FileLoader.java
注:本文中的org.openstreetmap.osmosis.xml.common.CompressionMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论