• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CompressionMethod类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PlatformAddress类代码示例发布时间:2022-05-22
下一篇:
Java FileTextField类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap