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


Java BrotliStreamCompressor类代码示例

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


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

示例1: init

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
@Setup
public void init() throws IOException {
  BrotliLibraryLoader.loadBrotli();

  brotliParameter = new Brotli.Parameter(Brotli.Mode.GENERIC, 5, Brotli.DEFAULT_LGWIN, Brotli.DEFAULT_LGBLOCK);

  brotliCompressor = new BrotliCompressor();
  brotliStreamCompressor = new BrotliStreamCompressor(brotliParameter);

  out = new byte[24603];
  outByteBuffer = ByteBuffer.allocateDirect(24603);
  arrayOutputStream = new ByteArrayOutputStream(24603);

  cpHtmlData = loadCanterburyCorpusHtmlFile();
  cpHtmlDataByteBuffer = ByteBuffer.allocateDirect(cpHtmlData.length);
  cpHtmlDataByteBuffer.put(cpHtmlData);
}
 
开发者ID:MeteoGroup,项目名称:jbrotli,代码行数:18,代码来源:Brotli_vs_Gzip_Benchmark.java

示例2: brotliCompress

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
private byte[] brotliCompress(byte[] bytes) {
    BrotliLibraryLoader.loadBrotli();

    Brotli.Parameter param = new Brotli.Parameter()
            .setMode(Brotli.Mode.TEXT)
            .setQuality(11)
            .setLgwin(10)
            .setLgblock(0);
    BrotliStreamCompressor streamCompressor = new BrotliStreamCompressor(param);
    byte[] compressed = streamCompressor.compressArray(bytes, true);
    streamCompressor.close();

    return compressed;
}
 
开发者ID:m-abboud,项目名称:FontVerter,代码行数:15,代码来源:Woff2Font.java

示例3: compress

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
public static byte[] compress(byte[] input) {
    BrotliStreamCompressor compressor = new BrotliStreamCompressor();
    return compressor.compressArray(input, true);
}
 
开发者ID:mikroskeem,项目名称:Shuriken,代码行数:5,代码来源:Utils.java

示例4: BrotliOutputStream

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
public BrotliOutputStream(OutputStream outputStream, Brotli.Parameter parameter) {
  this.outputStream = outputStream;
  brotliStreamCompressor = new BrotliStreamCompressor(parameter);
}
 
开发者ID:MeteoGroup,项目名称:jbrotli,代码行数:5,代码来源:BrotliOutputStream.java

示例5: assertCompressorHasSmallerBuffer

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
private void assertCompressorHasSmallerBuffer(Brotli.Parameter parameter) {
  try (BrotliStreamCompressor aCompressor = new BrotliStreamCompressor(parameter)) {
    assertThat(aCompressor.getMaxInputBufferSize()).isLessThan(testBytes.length);
  }
}
 
开发者ID:MeteoGroup,项目名称:jbrotli,代码行数:6,代码来源:BrotliOutputStreamTest.java

示例6: run

import org.meteogroup.jbrotli.BrotliStreamCompressor; //导入依赖的package包/类
private void run() throws Exception {
  BrotliLibraryLoader.loadBrotli();

  byte[] data = loadDemoData();

  BrotliStreamCompressor brotliStreamCompressor = new BrotliStreamCompressor(Brotli.DEFAULT_PARAMETER);
  byte[] compressedBuffer = brotliStreamCompressor.compressArray(data, true);

  writeDemoDataCompressed(compressedBuffer);
}
 
开发者ID:MeteoGroup,项目名称:jbrotli,代码行数:11,代码来源:TestSingleFileCompression.java


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