int inflateSetDictionary(byte[] dictionary, int dictLength){ if(z==null || (this.mode != DICT0 && this.wrap != 0)){ return Z_STREAM_ERROR; } int index=0; int length = dictLength; if(this.mode==DICT0){ long adler_need=z.adler.getValue(); z.adler.reset(); z.adler.update(dictionary, 0, dictLength); if(z.adler.getValue()!=adler_need){ return Z_DATA_ERROR; } } z.adler.reset(); if(length >= (1<<this.wbits)){ length = (1<<this.wbits)-1; index=dictLength - length; } this.blocks.set_dictionary(dictionary, index, length); this.mode = BLOCKS; return Z_OK; }
private void checksum(int n, long v){ for(int i=0; i<n; i++){ crcbuf[i]=(byte)(v&0xff); v>>=8; } z.adler.update(crcbuf, 0, n); }
void reset(){ if(mode==BTREE || mode==DTREE){ } if(mode==CODES){ codes.free(z); } mode=TYPE; bitk=0; bitb=0; read=write=0; if(check){ z.adler.reset(); } }
public long getAdler(){ return adler.getValue(); }
static int deflateCopy(ZStream dest, ZStream src){ if(src.dstate == null){ return Z_STREAM_ERROR; } if(src.next_in!=null){ dest.next_in = new byte[src.next_in.length]; System.arraycopy(src.next_in, 0, dest.next_in, 0, src.next_in.length); } dest.next_in_index = src.next_in_index; dest.avail_in = src.avail_in; dest.total_in = src.total_in; if(src.next_out!=null){ dest.next_out = new byte[src.next_out.length]; System.arraycopy(src.next_out, 0, dest.next_out ,0 , src.next_out.length); } dest.next_out_index = src.next_out_index; dest.avail_out = src.avail_out; dest.total_out = src.total_out; dest.msg = src.msg; dest.data_type = src.data_type; dest.adler = src.adler.copy(); try{ dest.dstate = (Deflate)src.dstate.clone(); dest.dstate.strm = dest; } catch(CloneNotSupportedException e){ // } return Z_OK; }
private void checksum(int n, long v){ for(int i=0; i<n; i++){ crcbuf[i]=(byte)(v&0xff); v>>=8; } z.adler.update(crcbuf, 0, n); }
void reset(){ if(mode==BTREE || mode==DTREE){ } if(mode==CODES){ codes.free(z); } mode=TYPE; bitk=0; bitb=0; read=write=0; if(check){ z.adler.reset(); } }
public long getAdler(){ return adler.getValue(); }
static int deflateCopy(ZStream dest, ZStream src){ if(src.dstate == null){ return Z_STREAM_ERROR; } if(src.next_in!=null){ dest.next_in = new byte[src.next_in.length]; System.arraycopy(src.next_in, 0, dest.next_in, 0, src.next_in.length); } dest.next_in_index = src.next_in_index; dest.avail_in = src.avail_in; dest.total_in = src.total_in; if(src.next_out!=null){ dest.next_out = new byte[src.next_out.length]; System.arraycopy(src.next_out, 0, dest.next_out ,0 , src.next_out.length); } dest.next_out_index = src.next_out_index; dest.avail_out = src.avail_out; dest.total_out = src.total_out; dest.msg = src.msg; dest.data_type = src.data_type; dest.adler = src.adler.copy(); try{ dest.dstate = (Deflate)src.dstate.clone(); dest.dstate.strm = dest; } catch(CloneNotSupportedException e){ // } return Z_OK; }
int inflateSetDictionary(byte[] dictionary, int dictLength){ if(z==null || (this.mode != DICT0 && this.wrap != 0)){ return Z_STREAM_ERROR; } int index=0; int length = dictLength; if(this.mode==DICT0){ long adler_need=z.adler.getValue(); z.adler.reset(); z.adler.update(dictionary, 0, dictLength); if(z.adler.getValue()!=adler_need){ return Z_DATA_ERROR; } } z.adler.reset(); if(length >= (1<<this.wbits)){ length = (1<<this.wbits)-1; index=dictLength - length; } this.blocks.set_dictionary(dictionary, index, length); this.mode = BLOCKS; return Z_OK; }
private void checksum(int n, long v){ for(int i=0; i<n; i++){ crcbuf[i]=(byte)(v&0xff); v>>=8; } z.adler.update(crcbuf, 0, n); }
void reset(){ if(mode==BTREE || mode==DTREE){ } if(mode==CODES){ codes.free(z); } mode=TYPE; bitk=0; bitb=0; read=write=0; if(check){ z.adler.reset(); } }
public long getAdler(){ return adler.getValue(); }
static int deflateCopy(ZStream dest, ZStream src){ if(src.dstate == null){ return Z_STREAM_ERROR; } if(src.next_in!=null){ dest.next_in = new byte[src.next_in.length]; System.arraycopy(src.next_in, 0, dest.next_in, 0, src.next_in.length); } dest.next_in_index = src.next_in_index; dest.avail_in = src.avail_in; dest.total_in = src.total_in; if(src.next_out!=null){ dest.next_out = new byte[src.next_out.length]; System.arraycopy(src.next_out, 0, dest.next_out ,0 , src.next_out.length); } dest.next_out_index = src.next_out_index; dest.avail_out = src.avail_out; dest.total_out = src.total_out; dest.msg = src.msg; dest.data_type = src.data_type; dest.adler = src.adler.copy(); try{ dest.dstate = (Deflate)src.dstate.clone(); dest.dstate.strm = dest; } catch(CloneNotSupportedException e){ // } return Z_OK; }
int inflateSetDictionary(byte[] dictionary, int dictLength){ if(z==null || (this.mode != DICT0 && this.wrap != 0)){ return Z_STREAM_ERROR; } int index=0; int length = dictLength; if(this.mode==DICT0){ long adler_need=z.adler.getValue(); z.adler.reset(); z.adler.update(dictionary, 0, dictLength); if(z.adler.getValue()!=adler_need){ return Z_DATA_ERROR; } } z.adler.reset(); if(length >= (1<<this.wbits)){ length = (1<<this.wbits)-1; index=dictLength - length; } this.blocks.set_dictionary(dictionary, index, length); this.mode = BLOCKS; return Z_OK; }
getGZIPHeader().put(this); status=BUSY_STATE; strm.adler.reset(); long adler=strm.adler.getValue(); putShortMSB((int)(adler>>>16)); putShortMSB((int)(adler&0xffff)); strm.adler.reset(); long adler=strm.adler.getValue(); put_byte((byte)(adler&0xff)); put_byte((byte)((adler>>8)&0xff)); long adler=strm.adler.getValue(); putShortMSB((int)(adler>>>16)); putShortMSB((int)(adler&0xffff));
int read_buf(byte[] buf, int start, int size) { int len=avail_in; if(len>size) len=size; if(len==0) return 0; avail_in-=len; if(dstate.wrap!=0) { adler.update(next_in, next_in_index, len); } System.arraycopy(next_in, next_in_index, buf, start, len); next_in_index += len; total_in += len; return len; }