@Override public long getValue() { return impl.getValue(); }
@Override public void reset() { impl.reset(); }
@Override public void update(byte[] buf, int off, int nbytes) { // avoid int overflow, check null buf if (off <= buf.length && nbytes >= 0 && off >= 0 && buf.length - off >= nbytes) { impl.update(buf, off, nbytes); } else { throw new ArrayIndexOutOfBoundsException(); } } }
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.noheader==0) { adler=_adler.adler32(adler, 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; }
public Adler32 copy(){ Adler32 foo = new Adler32(); foo.s1 = this.s1; foo.s2 = this.s2; return foo; }
public static long adler32_combine(long adler1, long adler2, long len2){ return Adler32.combine(adler1, adler2, len2); }
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.noheader==0) { adler=_adler.adler32(adler, 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; }
public Adler32 copy(){ Adler32 foo = new Adler32(); foo.s1 = this.s1; foo.s2 = this.s2; return foo; }
public static long adler32_combine(long adler1, long adler2, long len2){ return Adler32.combine(adler1, adler2, len2); }
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.noheader==0) { adler=_adler.adler32(adler, 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; }
public Adler32 copy(){ Adler32 foo = new Adler32(); foo.s1 = this.s1; foo.s2 = this.s2; return foo; }
public static long adler32_combine(long adler1, long adler2, long len2){ return Adler32.combine(adler1, adler2, len2); }
int inflateSetDictionary(ZStream z, byte[] dictionary, int dictLength){ int index=0; int length = dictLength; if(z==null || z.istate == null|| z.istate.mode != DICT0) return Z_STREAM_ERROR; if(z._adler.adler32(1L, dictionary, 0, dictLength)!=z.adler){ return Z_DATA_ERROR; } z.adler = z._adler.adler32(0, null, 0, 0); if(length >= (1<<z.istate.wbits)){ length = (1<<z.istate.wbits)-1; index=dictLength - length; } z.istate.blocks.set_dictionary(dictionary, index, length); z.istate.mode = BLOCKS; return Z_OK; }
public ZStream(){ this(new Adler32()); }
int inflateSetDictionary(ZStream z, byte[] dictionary, int dictLength){ int index=0; int length = dictLength; if(z==null || z.istate == null|| z.istate.mode != DICT0) return Z_STREAM_ERROR; if(z._adler.adler32(1L, dictionary, 0, dictLength)!=z.adler){ return Z_DATA_ERROR; } z.adler = z._adler.adler32(0, null, 0, 0); if(length >= (1<<z.istate.wbits)){ length = (1<<z.istate.wbits)-1; index=dictLength - length; } z.istate.blocks.set_dictionary(dictionary, index, length); z.istate.mode = BLOCKS; return Z_OK; }
public ZStream(){ this(new Adler32()); }
int inflateSetDictionary(ZStream z, byte[] dictionary, int dictLength){ int index=0; int length = dictLength; if(z==null || z.istate == null|| z.istate.mode != DICT0) return Z_STREAM_ERROR; if(z._adler.adler32(1L, dictionary, 0, dictLength)!=z.adler){ return Z_DATA_ERROR; } z.adler = z._adler.adler32(0, null, 0, 0); if(length >= (1<<z.istate.wbits)){ length = (1<<z.istate.wbits)-1; index=dictLength - length; } z.istate.blocks.set_dictionary(dictionary, index, length); z.istate.mode = BLOCKS; return Z_OK; }
public ZStream(){ this(new Adler32()); }
int deflateSetDictionary (ZStream strm, byte[] dictionary, int dictLength){ int length = dictLength; int index=0; if(dictionary == null || status != INIT_STATE) return Z_STREAM_ERROR; strm.adler=strm._adler.adler32(strm.adler, dictionary, 0, dictLength); if(length < MIN_MATCH) return Z_OK; if(length > w_size-MIN_LOOKAHEAD){ length = w_size-MIN_LOOKAHEAD; index=dictLength-length; // use the tail of the dictionary } System.arraycopy(dictionary, index, window, 0, length); strstart = length; block_start = length; // Insert all strings in the hash table (except for the last two bytes). // s->lookahead stays null, so s->ins_h will be recomputed at the next // call of fill_window. ins_h = window[0]&0xff; ins_h=(((ins_h)<<hash_shift)^(window[1]&0xff))&hash_mask; for(int n=0; n<=length-MIN_MATCH; n++){ ins_h=(((ins_h)<<hash_shift)^(window[(n)+(MIN_MATCH-1)]&0xff))&hash_mask; prev[n&w_mask]=head[ins_h]; head[ins_h]=(short)n; } return Z_OK; }
z.adler=new Adler32();