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

Java SnappyOutputStream类代码示例

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

本文整理汇总了Java中org.iq80.snappy.SnappyOutputStream的典型用法代码示例。如果您正苦于以下问题:Java SnappyOutputStream类的具体用法?Java SnappyOutputStream怎么用?Java SnappyOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SnappyOutputStream类属于org.iq80.snappy包,在下文中一共展示了SnappyOutputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: allFloatParameterCombinationsKnockout

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Test
public void allFloatParameterCombinationsKnockout() throws IOException {
    final List<float[]> fullData = loadFullFloatData();

    try (BufferedWriter noSplitWriter = openWriter("floats-knockout-nosplit");
         BufferedWriter splitWriter = openWriter("floats-knockout")) {
        for (float knockout : new float[] { 0f, 0.1f, 0.5f, 0.75f }) {
            final Random r = new Random(1337);
            final List<float[]> check = fullData.stream().map(xs -> {
                final float[] ys = xs.clone();
                for (int i = 0; i < ys.length; i++) {
                    if (r.nextDouble() < knockout) {
                        ys[i] = Float.NaN;
                    }
                }
                return ys;
            }).collect(Collectors.toList());

            allFloatParameterCombinationsWork(check, "Snappy\t" + knockout, SnappyOutputStream::new, SnappyInputStream::new, noSplitWriter, splitWriter);
        }
    }
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:23,代码来源:ConditionerParameterSearchTest.java


示例2: allDoubleParameterCombinationsKnockout

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Test
public void allDoubleParameterCombinationsKnockout() throws IOException {
    final List<double[]> fullData = loadFullDoubleData();

    try (BufferedWriter noSplitWriter = openWriter("doubles-knockout-nosplit");
         BufferedWriter splitWriter = openWriter("doubles-knockout")) {
        for (float knockout : new float[] { 0f, 0.1f, 0.5f, 0.75f }) {
            final Random r = new Random(1337);
            final List<double[]> check = fullData.stream().map(xs -> {
                final double[] ys = xs.clone();
                for (int i = 0; i < ys.length; i++) {
                    if (r.nextDouble() < knockout) {
                        ys[i] = Double.NaN;
                    }
                }
                return ys;
            }).collect(Collectors.toList());

            allDoubleParameterCombinationsWork(check, "Snappy\t" + knockout, SnappyOutputStream::new, SnappyInputStream::new, noSplitWriter, splitWriter);
        }
    }
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:23,代码来源:ConditionerParameterSearchTest.java


示例3: archiveState

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Nonnull
private static byte[] archiveState(@Nonnull Element state) {
  BufferExposingByteArrayOutputStream byteOut = new BufferExposingByteArrayOutputStream();
  try {
    OutputStreamWriter writer = new OutputStreamWriter(new SnappyOutputStream(byteOut), CharsetToolkit.UTF8_CHARSET);
    try {
      XMLOutputter xmlOutputter = new JDOMUtil.MyXMLOutputter();
      xmlOutputter.setFormat(XML_FORMAT);
      xmlOutputter.output(state, writer);
    }
    finally {
      writer.close();
    }
  }
  catch (IOException e) {
    throw new StateStorageException(e);
  }
  return ArrayUtil.realloc(byteOut.getInternalBuffer(), byteOut.size());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:StateMap.java


示例4: benchmark

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Test
public void benchmark() throws IOException {
    /*
    Snappy compress: 0.156672s
    Compressed to 10876881 bytes
    Uncompresses to 12908620 bytes
    Snappy decompress: 0.162463s

    Deflate Fastest compress: 6.017877s
    Compressed to 7770401 bytes
    Uncompresses to 12908620 bytes
    Deflate Fastest decompress: 4.260146s

    Deflate Slowest compress: 7.06043s
    Compressed to 7492001 bytes
    Uncompresses to 12908620 bytes
    Deflate Slowest decompress: 3.968221s

    Deflate Normal compress: 5.201332s
    Compressed to 7515522 bytes
    Uncompresses to 12908620 bytes
    Deflate Normal decompress: 4.056792s
     */
    benchmark("None",            x -> x,                                                                         x -> x);
    benchmark("None",            x -> x,                                                                         x -> x);
    benchmark("Snappy",          SnappyOutputStream::new,                                                        SnappyInputStream::new);
    benchmark("GZip",            GZIPOutputStream::new,                                                          GZIPInputStream::new);
    benchmark("Deflate Fastest", os -> new DeflaterOutputStream(os, new Deflater(Deflater.BEST_SPEED)),          InflaterInputStream::new);
    benchmark("Deflate Normal",  os -> new DeflaterOutputStream(os, new Deflater(Deflater.DEFAULT_COMPRESSION)), InflaterInputStream::new);
    benchmark("Deflate Slowest", os -> new DeflaterOutputStream(os, new Deflater(Deflater.BEST_COMPRESSION)),    InflaterInputStream::new);
    benchmark("BZip2 Fastest",   os -> new BZip2CompressorOutputStream(os, BZip2CompressorOutputStream.MIN_BLOCKSIZE), BZip2CompressorInputStream::new);
    benchmark("BZip2 Slowest",   os -> new BZip2CompressorOutputStream(os, BZip2CompressorOutputStream.MAX_BLOCKSIZE), BZip2CompressorInputStream::new);
    benchmark("XZ Fastest",      os -> new XZCompressorOutputStream(os, LZMA2Options.PRESET_MIN),                      XZCompressorInputStream::new);
    benchmark("XZ Normal",       os -> new XZCompressorOutputStream(os, LZMA2Options.PRESET_DEFAULT),                  XZCompressorInputStream::new);
    benchmark("XZ Slowest",      os -> new XZCompressorOutputStream(os, LZMA2Options.PRESET_MAX),                      XZCompressorInputStream::new);
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:37,代码来源:ConditionerParameterSearchTest.java


示例5: allFloatParameterCombinationsWork

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Test
public void allFloatParameterCombinationsWork() throws IOException {
    try (BufferedWriter noSplitWriter = openWriter("floats-nosplit");
         BufferedWriter splitWriter = openWriter("floats")) {
        allFloatParameterCombinationsWork(loadFullFloatData(), "Snappy", SnappyOutputStream::new,                                                              SnappyInputStream::new,          noSplitWriter, splitWriter);
        allFloatParameterCombinationsWork(loadFullFloatData(), "BZ2",    os -> new BZip2CompressorOutputStream(os, BZip2CompressorOutputStream.MIN_BLOCKSIZE), BZip2CompressorInputStream::new, noSplitWriter, splitWriter);
    }
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:9,代码来源:ConditionerParameterSearchTest.java


示例6: allDoubleParameterCombinationsWork

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Test
public void allDoubleParameterCombinationsWork() throws IOException {
    try (BufferedWriter noSplitWriter = openWriter("doubles-nosplit");
         BufferedWriter splitWriter = openWriter("doubles")) {
        allDoubleParameterCombinationsWork(loadFullDoubleData(), "Snappy", SnappyOutputStream::new,                                                              SnappyInputStream::new,          noSplitWriter, splitWriter);
        allDoubleParameterCombinationsWork(loadFullDoubleData(), "BZ2",    os -> new BZip2CompressorOutputStream(os, BZip2CompressorOutputStream.MIN_BLOCKSIZE), BZip2CompressorInputStream::new, noSplitWriter, splitWriter);
    }
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:9,代码来源:ConditionerParameterSearchTest.java


示例7: writeBlock

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
void writeBlock(int[] block, int blockNo, String name) throws Exception {
	String directory = index.cacheDir;
	File f = index.getFilesInterface().createFile(
			directory + File.separator + name + File.separator + blockNo);
	if (f.exists()) {
		File savedDir = index.getFilesInterface().createFile(
				directory + File.separator + "saved-" + name);
		savedDir.mkdirs();
		File savedF = index.getFilesInterface().createFile(
				directory + File.separator + "saved-" + name
						+ File.separator + blockNo);
		int i = 1;
		while (savedF.exists()) {
			savedF = index.getFilesInterface().createFile(
					directory + File.separator + "saved-" + name
							+ File.separator + blockNo + "-" + i++);
		}
		f.renameTo(savedF);
	}
	OutputStream writer = index.getFilesInterface().createOutputStream(f);
	DataOutputStream stream = new DataOutputStream(new SnappyOutputStream(
			writer));
	// writer);

	int sz = block[0];
	if (tmpBuffer.length < sz * 4) {
		tmpBuffer = new byte[sz * 4];
		intBuffer = ByteBuffer.wrap(tmpBuffer).asIntBuffer();
	}

	intBuffer.rewind();
	intBuffer.put(block, 0, sz);
	stream.write(tmpBuffer, 0, sz * 4);
	stream.close();
	writer.close();
	trimFile(f);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:38,代码来源:FirstLayer.java


示例8: createStream

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
private static FDataOutput createStream(File cacheFile)
		throws FileNotFoundException, IOException {
	cacheFile.deleteOnExit();

	OutputStream fout = new SnappyOutputStream(new BufferedOutputStream(
			new FileOutputStream(cacheFile)));
	return new FDataOutput(fout);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:9,代码来源:SortedBucketCache.java


示例9: saveContent

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
public void saveContent(@Nonnull String fileSpec, @Nonnull RoamingType roamingType, byte[] content, int size) throws IOException {
  UnsyncByteArrayOutputStream out = new UnsyncByteArrayOutputStream(size);
  try (SnappyOutputStream snappyOutputStream = new SnappyOutputStream(out)) {
    snappyOutputStream.write(content, 0, size);
  }

  byte[] compressedContent = out.toByteArray();

  myQueue.wantSave(myProxyDirectory, fileSpec, roamingType, compressedContent);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:ExternalStorage.java


示例10: init

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Override
public void init(File file) {
	try {
		os = new DataOutputStream(new SnappyOutputStream(
				new BufferedOutputStream(new FileOutputStream(file),
						65536)));
	} catch (Exception e) {
		log.error("Error", e);
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:11,代码来源:TripleFileStorage.java


示例11: OutputStream

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
public OutputStream(java.io.OutputStream stream) throws IOException {
  myUnderlyingOutputStream = new SnappyOutputStream(stream);
  myOutputStream = new CompactDataOutput(myUnderlyingOutputStream);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:OutputInfoSerializer.java


示例12: snappy

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Benchmark
public int snappy() throws IOException {
    return benchmark(SnappyOutputStream::new,                                                        SnappyInputStream::new);
}
 
开发者ID:batterseapower,项目名称:timeseries-compression,代码行数:5,代码来源:JMHCompressorTest.java


示例13: output

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
@Override
public OutputStream output(OutputStream out) throws IOException {
    return new SnappyOutputStream(out);
}
 
开发者ID:yammer,项目名称:backups,代码行数:5,代码来源:SnappyCompressionCodec.java


示例14: writeListBlockToFile

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
void writeListBlockToFile(ListBlocks b, int no, boolean writeBlocks)
		throws Exception {
	String name = "lb-" + no;
	File file = index.getFilesInterface().createFile(
			index.cacheDir + "/" + name);
	if (!file.mkdirs() && (!file.exists() || !file.isDirectory())) {
		log.warn(index.cacheDir + File.separator + name
				+ ": could not create");
		/*
		 * Don't make this a fatal error ... --Ceriel throw new
		 * IOException("Could not create" + index.cacheDir + File.separator
		 * + name);
		 */
	}
	file = index.getFilesInterface().createFile(
			index.cacheDir + "/" + name + "/index");
	if (log.isDebugEnabled()) {
		log.debug("write index of ListBlock " + index.cacheDir + "/" + name);
	}
	if (file.exists()) {
		File savedDir = index.getFilesInterface().createFile(
				index.cacheDir + "/" + "saved-" + name);
		savedDir.mkdirs();
		File savedF = index.getFilesInterface().createFile(
				index.cacheDir + "/" + "saved-" + name + "/index");
		int i = 1;
		while (savedF.exists()) {
			savedF = index.getFilesInterface().createFile(
					index.cacheDir + "/" + "saved-" + name + "/index-"
							+ i++);
		}
		file.renameTo(savedF);
	}
	OutputStream writer = index.getFilesInterface()
			.createOutputStream(file);
	DataOutputStream stream = new DataOutputStream(new SnappyOutputStream(
			writer));
	// writer);
	b.writeTo(stream, writeBlocks);
	stream.flush();
	stream.close();
	writer.flush();
	writer.close();
	trimFile(file);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:46,代码来源:FirstLayer.java


示例15: wrapOutputStream

import org.iq80.snappy.SnappyOutputStream; //导入依赖的package包/类
protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
    return new SnappyOutputStream(underlying);
}
 
开发者ID:we7,项目名称:voldemort,代码行数:4,代码来源:SnappyCompressionStrategy.java



注:本文中的org.iq80.snappy.SnappyOutputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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