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


Java LZ4BlockOutputStream类代码示例

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


LZ4BlockOutputStream类属于net.jpountz.lz4包,在下文中一共展示了LZ4BlockOutputStream类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

示例5: openWriter

import net.jpountz.lz4.LZ4BlockOutputStream; //导入依赖的package包/类
private void openWriter() throws IOException {
    if (written) {
        throw new IllegalStateException("list is already closed");
    }
    if (writing) {
        throw new IllegalStateException("already writing on this list");
    }
    if (compressionEnabled) {
        this.tmpFile = Files.createTempFile(tmpDir, "listswap", ".tmp.gz");
    } else {
        this.tmpFile = Files.createTempFile(tmpDir, "listswap", ".tmp");
    }
    logger.log(Level.FINE, "opening tmp swap file {0}", tmpFile.toAbsolutePath());
    writing = true;
    try {
        out = Files.newOutputStream(tmpFile);
        bout = new SimpleBufferedOutputStream(out, DISK_BUFFER_SIZE);
        if (compressionEnabled) {
            zippedout = new LZ4BlockOutputStream(out);
            oout = new ExtendedDataOutputStream(zippedout);
        } else {
            oout = new ExtendedDataOutputStream(bout);
        }

    } catch (IOException ex) {
        closeWriter();
        throw new RuntimeException(ex);
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:30,代码来源:DiskArrayList.java

示例6: update

import net.jpountz.lz4.LZ4BlockOutputStream; //导入依赖的package包/类
public void update(byte[] key, byte[] value) throws IOException {
    numKeys++;
    try {
        updateUnsafe(key, value);
    } catch (NullPointerException e) {
        file.getParentFile().mkdirs();
        file.createNewFile();
        this.os = new FaweOutputStream(new BufferedOutputStream(new ZstdOutputStream(new LZ4BlockOutputStream(new FileOutputStream(file)))));
        updateUnsafe(key, value);
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:MCAFile2LevelDB.java

示例7: flushChanges

import net.jpountz.lz4.LZ4BlockOutputStream; //导入依赖的package包/类
default void flushChanges(File file) throws IOException {
        try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) {
            try (LZ4BlockOutputStream compressed = new LZ4BlockOutputStream(out)) {
//                compressed.setLevel(Deflater.BEST_SPEED);
                try (FaweOutputStream fos = new FaweOutputStream(compressed)) {
                    flushChanges(fos);
                }
            }
        }
    }
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:StreamChange.java

示例8: getOutputStream

import net.jpountz.lz4.LZ4BlockOutputStream; //导入依赖的package包/类
@Override
public OutputStream getOutputStream(final OutputStream out) throws IOException {

	return new LZ4BlockOutputStream(out, blockSize);
}
 
开发者ID:saalfeldlab,项目名称:n5,代码行数:6,代码来源:Lz4Compression.java

示例9: wrapOut

import net.jpountz.lz4.LZ4BlockOutputStream; //导入依赖的package包/类
@Override
@Nonnull
public OutputStream wrapOut(@Nonnull OutputStream out, int option) throws IOException {
	return option == -1 ? new LZ4BlockOutputStream(out) : new LZ4BlockOutputStream(out, option);
}
 
开发者ID:lithiumtech,项目名称:flow,代码行数:6,代码来源:Lz4Coder.java


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