gpt4 book ai didi

com.jcraft.jzlib.ZStream类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 17:12:40 29 4
gpt4 key购买 nike

本文整理了Java中com.jcraft.jzlib.ZStream类的一些代码示例,展示了ZStream类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZStream类的具体详情如下:
包路径:com.jcraft.jzlib.ZStream
类名称:ZStream

ZStream介绍

[英]ZStream
[中]ZStream

代码示例

代码示例来源:origin: com.jcraft/jzlib

int deflateParams(int _level, int _strategy){
 int err=Z_OK;
 if(_level == Z_DEFAULT_COMPRESSION){
  _level = 6;
 }
 if(_level < 0 || _level > 9 || 
   _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {
  return Z_STREAM_ERROR;
 }
 if(config_table[level].func!=config_table[_level].func &&
   strm.total_in != 0) {
  // Flush the last buffer:
  err = strm.deflate(Z_PARTIAL_FLUSH);
 }
 if(level != _level) {
  level = _level;
  max_lazy_match   = config_table[level].max_lazy;
  good_match       = config_table[level].good_length;
  nice_match       = config_table[level].nice_length;
  max_chain_length = config_table[level].max_chain;
 }
 strategy = _strategy;
 return err;
}

代码示例来源:origin: is/jsch

public void init(int type, int level){
 if(type==DEFLATER){
  stream.deflateInit(level);
  this.type=DEFLATER;
 }
 else if(type==INFLATER){
  stream.inflateInit();
  inflated_buf=new byte[BUF_SIZE];
  this.type=INFLATER;
 }
}

代码示例来源:origin: net.schmizz/sshj

@Override
public void init(Mode mode) {
  stream = new ZStream();
  switch (mode) {
    case DEFLATE:
      stream.deflateInit(JZlib.Z_DEFAULT_COMPRESSION);
      break;
    case INFLATE:
      stream.inflateInit();
      break;
    default:
      assert false;
  }
}

代码示例来源:origin: google/sagetv

public void end() {
 if(z==null)
  return;
 if(compress){ z.deflateEnd(); }
 else{ z.inflateEnd(); }
 z.free();
 z=null;
}
public void close() throws IOException {

代码示例来源:origin: groboclown/p4ic4idea

public RpcGZIPOutputStream(OutputStream out) throws IOException {
  super(out);
  this.jzOutputSream = new ZStream();
  this.jzOutputSream.deflateInit(JZlib.Z_DEFAULT_COMPRESSION, ZBITS, true);
  this.jzBytes = new byte[ZBUF_SIZE];
  this.jzOutputSream.next_out = this.jzBytes;
  this.jzOutputSream.next_out_index = 0;
  this.jzOutputSream.avail_out = this.jzBytes.length;
}

代码示例来源:origin: jzlib/jzlib

public void write(byte b[], int off, int len) throws IOException {
 if(len==0)
  return;
 int err;
 z.next_in=b;
 z.next_in_index=off;
 z.avail_in=len;
 do{
  z.next_out=buf;
  z.next_out_index=0;
  z.avail_out=bufsize;
  if(compress)
   err=z.deflate(flush);
  else
   err=z.inflate(flush);
  if(err!=JZlib.Z_OK)
   throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
  out.write(buf, 0, bufsize-z.avail_out);
 } 
 while(z.avail_in>0 || z.avail_out==0);
}

代码示例来源:origin: com.jcraft.jzlib/com.springsource.com.jcraft.jzlib

public ZOutputStream(OutputStream out, int level, boolean nowrap) {
 super();
 this.out=out;
 z.deflateInit(level, nowrap);
 compress=true;
}

代码示例来源:origin: google/sagetv

public ZOutputStream(OutputStream out) {
 super();
 this.out=out;
 z.inflateInit();
 compress=false;
}

代码示例来源:origin: com.sshtools/maverick-common

public byte[] uncompress(byte[] buffer, int start, int length) throws IOException {

//    int inflated_end = 0;
  uncompressOut.reset();

  stream.next_in = buffer;
  stream.next_in_index = start;
  stream.avail_in = length;

  while(true) {
   stream.next_out = inflated_buf;
   stream.next_out_index = 0;
   stream.avail_out = BUF_SIZE;
   int status = stream.inflate(JZlib.Z_PARTIAL_FLUSH);
   switch(status) {
    case JZlib.Z_OK:
     uncompressOut.write(inflated_buf, 0, BUF_SIZE - stream.avail_out);
     break;
    case JZlib.Z_BUF_ERROR:
     return uncompressOut.toByteArray();
    default:
     throw new IOException("uncompress: inflate returnd " + status);
   }
  }
 }

代码示例来源:origin: vngx/vngx-jsch

/**
 * Creates a new instance of {@code Compression}.
 */
public CompressionImpl() {
  _zstream = new ZStream();
}

代码示例来源:origin: com.jcraft/jzlib

void flush_block_only(boolean eof){
 _tr_flush_block(block_start>=0 ? block_start : -1,
     strstart-block_start,
     eof);
 block_start=strstart;
 strm.flush_pending();
}

代码示例来源:origin: com.jcraft/jzlib

n = strm.read_buf(window, strstart + lookahead, more);
lookahead += n;

代码示例来源:origin: com.perforce/p4java

/**
 * Cleanly close the stream and finalize deflation (compression). No one dies
 * if you don't call this properly, but it certainly helps to close the
 * stream cleanly.
 * 
 * @see java.io.FilterOutputStream#close()
 */
@Override
public void close() throws IOException {
  this.jzOutputSream.deflateEnd();
}

代码示例来源:origin: org.apache.mina/mina-filter-compression

/**
   * Cleans up the resources used by the compression library.
   */
  public void cleanUp() {
    if (zStream != null) {
      zStream.free();
    }
  }
}

代码示例来源:origin: com.jcraft.jzlib/com.springsource.com.jcraft.jzlib

public void write(byte b[], int off, int len) throws IOException {
 if(len==0)
  return;
 int err;
 z.next_in=b;
 z.next_in_index=off;
 z.avail_in=len;
 do{
  z.next_out=buf;
  z.next_out_index=0;
  z.avail_out=bufsize;
  if(compress)
   err=z.deflate(flush);
  else
   err=z.inflate(flush);
  if(err!=JZlib.Z_OK)
   throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
  out.write(buf, 0, bufsize-z.avail_out);
 } 
 while(z.avail_in>0 || z.avail_out==0);
}

代码示例来源:origin: google/sagetv

public ZInputStream(InputStream in, int level) {
 super(in);
 this.in=in;
 z.deflateInit(level);
 compress=true;
 z.next_in=buf;
 z.next_in_index=0;
 z.avail_in=0;
}

代码示例来源:origin: google/sagetv

public ZInputStream(InputStream in, boolean nowrap) {
 super(in);
 this.in=in;
 z.inflateInit(nowrap);
 compress=false;
 z.next_in=buf;
 z.next_in_index=0;
 z.avail_in=0;
}

代码示例来源:origin: com.perforce/p4java

public RpcGZIPOutputStream(OutputStream out) throws IOException {
  super(out);
  this.jzOutputSream = new ZStream();
  this.jzOutputSream.deflateInit(JZlib.Z_DEFAULT_COMPRESSION, ZBITS, true);
  this.jzBytes = new byte[ZBUF_SIZE];
  this.jzOutputSream.next_out = this.jzBytes;
  this.jzOutputSream.next_out_index = 0;
  this.jzOutputSream.avail_out = this.jzBytes.length;
}

代码示例来源:origin: vngx/vngx-jsch

_zstream.next_out_index = 0;
_zstream.avail_out = BUF_SIZE;
status = _zstream.inflate(JZlib.Z_PARTIAL_FLUSH);
switch( status ) {
  case JZlib.Z_OK:

代码示例来源:origin: org.gridkit.lab/telecontrol-ssh

public Compression(){
 stream=new ZStream();
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com