当前位置: 首页>>代码示例>>Java>>正文


Java LZ4BlockOutputStream.close方法代码示例

本文整理汇总了Java中net.jpountz.lz4.LZ4BlockOutputStream.close方法的典型用法代码示例。如果您正苦于以下问题:Java LZ4BlockOutputStream.close方法的具体用法?Java LZ4BlockOutputStream.close怎么用?Java LZ4BlockOutputStream.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.jpountz.lz4.LZ4BlockOutputStream的用法示例。


在下文中一共展示了LZ4BlockOutputStream.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compress

import net.jpountz.lz4.LZ4BlockOutputStream; //导入方法依赖的package包/类
@Override
public byte[] compress( final byte[] data , final int start , final int length ) throws IOException{
  ByteArrayOutputStream bOut = new ByteArrayOutputStream();
  bOut.write( LENGTH_DUMMY , 0 , LENGTH_DUMMY.length );
  LZ4BlockOutputStream out = new LZ4BlockOutputStream( bOut );

  out.write( data , start , length );
  out.flush();
  out.finish();
  byte[] compressByte = bOut.toByteArray();
  ByteBuffer.wrap( compressByte ).putInt( length );

  bOut.close();
  out.close();

  return compressByte;
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:18,代码来源:LZ4Compressor.java

示例2: serializeCompressLZ4

import net.jpountz.lz4.LZ4BlockOutputStream; //导入方法依赖的package包/类
public synchronized int serializeCompressLZ4(T obj, File file) {
	try {
		byte[] barray = conf.get().asByteArray(obj);
		int compressedLength = barray.length;
		int decompressedLength = -1;
		// Notes: uses an LZ4 block size of 64KB, fast compressor 
		LZ4BlockOutputStream LZOS = new LZ4BlockOutputStream(new FileOutputStream(file));
		FSTObjectOutput oos = conf.get().getObjectOutput(LZOS);
		oos.writeObject(obj);
		oos.flush();
		LZOS.close();
		return decompressedLength;
	}
	catch(Exception e) {
		e.printStackTrace();
	}
	return -1;
}
 
开发者ID:ramusa2,项目名称:CandCNFPerceptronParser,代码行数:19,代码来源:FSTDiskSerializer.java

示例3: compress

import net.jpountz.lz4.LZ4BlockOutputStream; //导入方法依赖的package包/类
@Override
public byte[] compress(byte[] data) throws IOException {
	LZ4Factory factory = LZ4Factory.fastestInstance();
	ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
	LZ4Compressor compressor = factory.fastCompressor();
	LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(byteOutput, 2048, compressor);
	compressedOutput.write(data);
	compressedOutput.close();
	
	return byteOutput.toByteArray();
}
 
开发者ID:yu120,项目名称:compress,代码行数:12,代码来源:Lz4Compress.java

示例4: compress

import net.jpountz.lz4.LZ4BlockOutputStream; //导入方法依赖的package包/类
public static byte[] compress(byte srcBytes[]) throws IOException {
    LZ4Factory factory = LZ4Factory.fastestInstance();
    ByteArrayOutputStream byteOutput = new ByteArrayOutputStream();
    LZ4Compressor compressor = factory.fastCompressor();
    LZ4BlockOutputStream compressedOutput = new LZ4BlockOutputStream(
            byteOutput, 2048, compressor);
    compressedOutput.write(srcBytes);
    compressedOutput.close();
    return byteOutput.toByteArray();
}
 
开发者ID:Lazyeraser,项目名称:DereHelper,代码行数:11,代码来源:LZ4Helper.java


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