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); }
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); }
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); }
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; }
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; }
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; }
int deflateSetDictionary (byte[] dictionary, int dictLength){ int length = dictLength; int index=0; if(dictionary == null || status != INIT_STATE) return Z_STREAM_ERROR; strm.adler.update(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; }
int deflateSetDictionary (byte[] dictionary, int dictLength){ int length = dictLength; int index=0; if(dictionary == null || status != INIT_STATE) return Z_STREAM_ERROR; strm.adler.update(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; }
int deflateSetDictionary (byte[] dictionary, int dictLength){ int length = dictLength; int index=0; if(dictionary == null || status != INIT_STATE) return Z_STREAM_ERROR; strm.adler.update(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; }
private int readString(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; do { if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; if(b!=0) tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; }while(b!=0); return r; }
private int readString(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; do { if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; if(b!=0) tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; }while(b!=0); return r; }
private int readString(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; do { if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; if(b!=0) tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; }while(b!=0); return r; }
private int readBytes(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; while(this.need>0){ if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; this.need--; } return r; }
private int readBytes(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; while(this.need>0){ if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; this.need--; } return r; }
private int readBytes(int r, int f) throws Return{ if(tmp_string == null){ tmp_string=new java.io.ByteArrayOutputStream(); } int b=0; while(this.need>0){ if(z.avail_in==0){ throw new Return(r); }; r=f; z.avail_in--; z.total_in++; b = z.next_in[z.next_in_index]; tmp_string.write(z.next_in, z.next_in_index, 1); z.adler.update(z.next_in, z.next_in_index, 1); z.next_in_index++; this.need--; } return r; }
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; }
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; }
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; }