gpt4 book ai didi

com.jcraft.jzlib.ZStream.deflate()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 16:50:40 26 4
gpt4 key购买 nike

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

ZStream.deflate介绍

暂无

代码示例

代码示例来源: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: google/sagetv

int deflateParams(ZStream strm, 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: ymnk/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: jzlib/jzlib

int deflateParams(ZStream strm, 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: com.jcraft.jzlib/com.springsource.com.jcraft.jzlib

int deflateParams(ZStream strm, 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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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: vngx/vngx-jsch

@Override
public int compress(byte[] buffer, int offset, int length) {
  _zstream.next_in = buffer;
  _zstream.next_in_index = offset;
  _zstream.avail_in = length - offset;
  int status, outputLen = offset;
  do {
    _zstream.next_out = _tmp;
    _zstream.next_out_index = 0;
    _zstream.avail_out = BUF_SIZE;
    status = _zstream.deflate(JZlib.Z_PARTIAL_FLUSH);
    switch( status ) {
      case JZlib.Z_OK:
        System.arraycopy(_tmp, 0, buffer, outputLen, BUF_SIZE - _zstream.avail_out);
        outputLen += (BUF_SIZE - _zstream.avail_out);
        break;
      default:
        // TODO Error handling?
        System.err.println("compress: deflate returned " + status);
    }
  } while( _zstream.avail_out == 0 );
  return outputLen;
}

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

public byte[] compress(byte[] buf, int start, int len) throws IOException {
 compressOut.reset();
 stream.next_in = buf;
 stream.next_in_index = start;
 stream.avail_in = len - start;
 int status;
 do {
  stream.next_out = tmpbuf;
  stream.next_out_index = 0;
  stream.avail_out = BUF_SIZE;
  status = stream.deflate(JZlib.Z_PARTIAL_FLUSH);
  switch(status) {
   case JZlib.Z_OK:
    compressOut.write(tmpbuf, 0, BUF_SIZE - stream.avail_out);
    break;
   default:
    throw new IOException("compress: deflate returnd " + status);
  }
 }
 while(stream.avail_out == 0);
 return compressOut.toByteArray();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch

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

代码示例来源:origin: org.mule.jsch/jsch

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

代码示例来源: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: 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: google/sagetv

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

err=z.deflate(flush);
 else
err=z.inflate(flush);

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

err=z.deflate(flush);
 else
err=z.inflate(flush);

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

err=z.deflate(flush);
 else
err=z.inflate(flush);

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

public void finish() throws IOException {
 int err;
 do{
  z.next_out=buf;
  z.next_out_index=0;
  z.avail_out=bufsize;
  if(compress){ err=z.deflate(JZlib.Z_FINISH);  }
  else{ err=z.inflate(JZlib.Z_FINISH); }
  if(err!=JZlib.Z_STREAM_END && err != JZlib.Z_OK)
  throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
  if(bufsize-z.avail_out>0){
 out.write(buf, 0, bufsize-z.avail_out);
  }
 }
 while(z.avail_in>0 || z.avail_out==0);
 flush();
}
public void end() {

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

public void finish() throws IOException {
 int err;
 do{
  z.next_out=buf;
  z.next_out_index=0;
  z.avail_out=bufsize;
  if(compress){ err=z.deflate(JZlib.Z_FINISH);  }
  else{ err=z.inflate(JZlib.Z_FINISH); }
  if(err!=JZlib.Z_STREAM_END && err != JZlib.Z_OK)
  throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
  if(bufsize-z.avail_out>0){
 out.write(buf, 0, bufsize-z.avail_out);
  }
 }
 while(z.avail_in>0 || z.avail_out==0);
 flush();
}
public void end() {

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

public void finish() throws IOException {
 int err;
 do{
  z.next_out=buf;
  z.next_out_index=0;
  z.avail_out=bufsize;
  if(compress){ err=z.deflate(JZlib.Z_FINISH);  }
  else{ err=z.inflate(JZlib.Z_FINISH); }
  if(err!=JZlib.Z_STREAM_END && err != JZlib.Z_OK)
  throw new ZStreamException((compress?"de":"in")+"flating: "+z.msg);
  if(bufsize-z.avail_out>0){
 out.write(buf, 0, bufsize-z.avail_out);
  }
 }
 while(z.avail_in>0 || z.avail_out==0);
 try { flush(); } 
 catch (IOException ignored) {
 }
}
public void end() throws IOException {

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

@Override
public void compress(Buffer buffer) {
  stream.next_in = buffer.array();
  stream.next_in_index = buffer.rpos();
  stream.avail_in = buffer.available();
  buffer.wpos(buffer.rpos());
  do {
    stream.next_out = tempBuf;
    stream.next_out_index = 0;
    stream.avail_out = BUF_SIZE;
    final int status = stream.deflate(JZlib.Z_PARTIAL_FLUSH);
    if (status == JZlib.Z_OK) {
      buffer.putRawBytes(tempBuf, 0, BUF_SIZE - stream.avail_out);
    } else {
      throw new SSHRuntimeException("compress: deflate returned " + status);
    }
  } while (stream.avail_out == 0);
}

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