亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lzssoutputstream.java

?? jzss壓縮算法
?? JAVA
字號:
/*************************************************** ************ LZSS compression routines ************ ***************************************************   This compression algorithm is based on the ideas of Lempel and Ziv,   with the modifications suggested by Storer and Szymanski. The algorithm    is based on the use of a ring buffer, which initially contains zeros.    We read several characters from the file into the buffer, and then    search the buffer for the longest string that matches the characters    just read, and output the length and position of the match in the buffer.   With a buffer size of 4096 bytes, the position can be encoded in 12   bits. If we represent the match length in four bits, the <position,   length> pair is two bytes long. If the longest match is no more than   two characters, then we send just one character without encoding, and   restart the process with the next letter. We must send one extra bit   each time to tell the decoder whether we are sending a <position,   length> pair or an unencoded character, and these flags are stored as   an eight bit mask every eight items.   This implementation uses binary trees to speed up the search for the   longest match.   Original code by Haruhiko Okumura, 4/6/1989.   12-2-404 Green Heights, 580 Nagasawa, Yokosuka 239, Japan.   Modified for use in the Allegro filesystem by Shawn Hargreaves.   Use, distribute, and modify this code freely.*/import java.io.FilterOutputStream;import java.io.OutputStream;import java.io.IOException;public class LZSSOutputStream extends FilterOutputStream{ final private static int N=4096;        /* 4k buffers for LZ compression */ final private static int F=18;          /* upper limit for LZ match length */ final private static int THRESHOLD=2;   /* LZ encode string into pos and length				       if match size is greater than this *//* stuff for doing LZ compression */   int state;                       /* where have we got to in the pack? */   int i, len, r, s;   byte c;   int last_match_length, code_buf_ptr;   byte mask;   byte code_buf[];   int match_position;   int match_length;   int lson[   ];                   /* left children, */   int rson[     ];                 /* right children, */   int dad[   ];                    /* and parents, = binary search trees */   byte text_buf[     ];            /* ring buffer, with F-1 extra bytes				       for string comparison */	LZSSOutputStream (OutputStream ou)	{		super(ou);		code_buf=new byte[17];		lson=new int[N+1];		rson=new int[N+257];		dad= new int[N+1];		text_buf=new byte[N+F-1];		state=0;	}/* pack_inittree: *  For i = 0 to N-1, rson[i] and lson[i] will be the right and left  *  children of node i. These nodes need not be initialized. Also, dad[i]  *  is the parent of node i. These are initialized to N, which stands for  *  'not used.' For i = 0 to 255, rson[N+i+1] is the root of the tree for  *  strings that begin with character i. These are initialized to N. Note  *  there are 256 trees. */	private final void inittree(){   int i;   for (i=N+1; i<=N+256; i++)      rson[i] = N;   for (i=0; i<N; i++)      dad[i] = N;}/* pack_insertnode: *  Inserts a string of length F, text_buf[r..r+F-1], into one of the trees  *  (text_buf[r]'th tree) and returns the longest-match position and length  *  via match_position and match_length. If match_length = F, then removes  *  the old node in favor of the new one, because the old one will be  *  deleted sooner. Note r plays double role, as tree node and position in  *  the buffer.  */private final void pack_insertnode(int r){   int i, p, cmp;//   unsigned char *key;//   unsigned char *text_buf = text_buf;   cmp = 1;//   key = &text_buf[r];   p = N + 1 + ( text_buf[r] & 0xFF);   rson[r] = lson[r] = N;   match_length = 0;   for (;;) {      if (cmp >= 0) {	 if (rson[p] != N)	    p = rson[p];	 else {	    rson[p] = r;	    dad[r] = p;	    return;	 }      }      else {	 if (lson[p] != N)	    p = lson[p];	 else {	    lson[p] = r;	    dad[r] = p;	    return;	 }      }      for (i = 1; i < F; i++)	 if ((cmp = (text_buf[r+i] & 0xff) - (text_buf[p + i]) & 0xFF) != 0) /* SIGN BUG? */	    break;      if (i > match_length) {	 match_position = p;	 if ((match_length = i) >= F)	    break;      }   }   dad[r] = dad[p];   lson[r] = lson[p];   rson[r] = rson[p];   dad[lson[p]] = r;   dad[rson[p]] = r;   if (rson[dad[p]] == p)      rson[dad[p]] = r;   else      lson[dad[p]] = r;   dad[p] = N;                 /* remove p */}/* pack_deletenode: *  Removes a node from a tree. */private final void pack_deletenode(int p ){   int q;   if (dad[p] == N)      return;     /* not in tree */   if (rson[p] == N)      q = lson[p];   else      if (lson[p] == N)	 q = rson[p];      else {	 q = lson[p];	 if (rson[q] != N) {	    do {	       q = rson[q];	    } while (rson[q] != N);	    rson[dad[q]] = lson[q];	    dad[lson[q]] = dad[q];	    lson[q] = lson[p];	    dad[lson[p]] = q;	 }	 rson[q] = rson[p];	 dad[rson[p]] = q;      }   dad[q] = dad[p];   if (rson[dad[p]] == p)      rson[dad[p]] = q;   else      lson[dad[p]] = q;   dad[p] = N;}/* pack_write: *  Called by flush_buffer(). Packs size bytes from buf, using the pack  *  information contained in dat. Returns 0 on success. */private final void pack_write(int size, byte buf[], int bufi,boolean last) throws IOException{ // System.out.println("Entering state="+state);   boolean skipme=false;   if(state==0)   {             code_buf[0] = 0;	     /* code_buf[1..16] saves eight units of code, and code_buf[0] works		 as eight flags, "1" representing that the unit is an unencoded		 letter (1 byte), "0" a position-and-length pair (2 bytes).		 Thus, eight units require at most 16 bytes of code. */              code_buf_ptr = mask = 1;              s = 0;              r = N - F;              inittree();	      len = 0;   } else if(state==1) len++;   if(state!=2)   {   while ( (len < F) && (size > 0)) {//   for (; (len < F) && (size > 0); len++) x      text_buf[r+len] = buf[bufi++];      if (--size == 0) {	 if (!last) {	    state = 1;	    return; 	 }      }      pos1:      len++;   }   if (len == 0) return;   for (i=1; i <= F; i++)      pack_insertnode(r-i);	    /* Insert the F strings, each of which begins with one or	       more 'space' characters. Note the order in which these	       strings are inserted. This way, degenerate trees will be	       less likely to occur. */   pack_insertnode(r);	    /* Finally, insert the whole string just read. match_length	       and match_position are set. */   } /* state!=2 */    else    {	    skipme=true;    }   do {      if(skipme==false)      {      if (match_length > len)	 match_length = len;  /* match_length may be long near the end */      if (match_length <= THRESHOLD) {	 match_length = 1;  /* not long enough match: send one byte */	 code_buf[0] |= mask;    /* 'send one byte' flag */	 code_buf[code_buf_ptr++] = text_buf[r]; /* send uncoded */      }      else {	 /* send position and length pair. Note match_length > THRESHOLD */	 code_buf[code_buf_ptr++] = (byte) match_position;	 code_buf[code_buf_ptr++] = (byte)				     (((match_position >>> 4) & 0xF0) |				      (match_length - (THRESHOLD + 1)));      }      if ((mask <<= 1) == 0) {               /* shift mask left one bit */				 /* send at most 8 units of */				 /* code together */ 	      out.write(code_buf,0,code_buf_ptr);	    code_buf[0] = 0;	    code_buf_ptr = mask = 1;      }      last_match_length = match_length;      i=0;      } /*skipme*/      /* jak se dostat dovnitr? */      /*      if(skipme==true && ((i < last_match_length) && (size > 0))== false)	      {		      System.out.println("Can not get inside.... size="+size);		      // skipme=false;	      }      */      for(;;) {    //  for (; (i < last_match_length) && (size > 0); i++) 	 if(skipme==false)  {         if( (i >= last_match_length) || (size <= 0) ) break;	   c = buf[bufi++];           if (--size == 0) {	      if (!last) {	          state = 2;	          return;	      }	   }	 }	   else {skipme=false;/* System.out.println("Skip in")*/;}	 pos2:	 pack_deletenode(s);    /* delete old strings and */	 text_buf[s] = c;      /* read new bytes */	 if (s < F-1)	    text_buf[s+N] = c; /* if the position is near the end of				       buffer, extend the buffer to make				       string comparison easier */	 s = (s+1) & (N-1);	 r = (r+1) & (N-1);         /* since this is a ring buffer,				       increment the position modulo N */	 pack_insertnode(r);    /* register the string in				       text_buf[r..r+F-1] */         i++;      }             while (i++ < last_match_length) {   /* after the end of text, */	 pack_deletenode(s);          /* no need to read, but */	 s = (s+1) & (N-1);               /* buffer may not be empty */	 r = (r+1) & (N-1);	 if (--len!=0)	    pack_insertnode(r);       }   } while (len > 0);   /* until length of string to be processed is zero */   if (code_buf_ptr > 1) {         /* send remaining code */      out.write(code_buf,0,code_buf_ptr);      return;   }   /* do not reset buffer */   // state = 0;}/* interface methods */public void write(byte zz[],int ofs, int sz) throws IOException{	pack_write(sz,zz,ofs,false);}public void flush() throws IOException{        // System.out.println("Flush state="+state);	pack_write(0,null,0,true);	super.flush();}public void close() throws IOException{	if(code_buf==null) throw new IOException("LZSSOutputStream allready closed");	try	{		flush();		out.close();        }	catch (IOException err)	{		throw err;	}	finally	{		out=null;		code_buf=null;		lson=null;		rson=null;		dad=null;		text_buf=null;        }}	protected final void finalize() throws Throwable{        try	{	  flush();	}	finally	 {	  super.finalize();	 }}} /* class */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品在线一区| 日韩免费观看高清完整版| 中文文精品字幕一区二区| 国产精品亚洲午夜一区二区三区| 久久综合久久鬼色| 国产成人av福利| 1024成人网| 欧美精品1区2区3区| 激情都市一区二区| 国产视频一区二区在线观看| 成人网在线播放| 樱桃视频在线观看一区| 91精品国产91热久久久做人人 | 亚洲成人在线免费| 欧美猛男超大videosgay| 美女一区二区视频| 国产农村妇女精品| 欧美视频日韩视频| 国产一区二区三区四| 中文字幕日韩一区二区| 欧美精选午夜久久久乱码6080| 久久99久久久欧美国产| 亚洲欧洲一区二区三区| 欧美日韩免费观看一区三区| 国内精品国产三级国产a久久| 国产精品五月天| 精品视频全国免费看| 激情欧美一区二区| 亚洲午夜电影网| 精品91自产拍在线观看一区| 91麻豆精品在线观看| 精品一区在线看| 一区二区日韩av| 久久蜜臀中文字幕| 欧美日韩国产一级片| 风间由美一区二区三区在线观看 | 亚洲三级小视频| 日韩色视频在线观看| 97超碰欧美中文字幕| 九一久久久久久| 一级日本不卡的影视| 久久色中文字幕| 欧美日韩卡一卡二| 成人av免费观看| 美女mm1313爽爽久久久蜜臀| 亚洲自拍欧美精品| 中文字幕日韩一区| 国产无人区一区二区三区| 91精品国产色综合久久不卡电影| a亚洲天堂av| 国产精品一卡二卡| 久久国产精品一区二区| 午夜欧美在线一二页| 亚洲图片激情小说| 国产精品全国免费观看高清| 欧美成人精品1314www| 欧美日韩国产乱码电影| 91蜜桃婷婷狠狠久久综合9色| 国产超碰在线一区| 国产一区二区三区四区五区入口| 日韩专区中文字幕一区二区| 亚洲午夜久久久久久久久电影网 | 国产欧美视频一区二区三区| 欧美成人女星排名| 欧美一区二区三区精品| 在线播放亚洲一区| 欧美日韩国产三级| 欧美日韩综合一区| 欧美少妇bbb| 欧美日韩久久一区| 91精品啪在线观看国产60岁| 欧美日韩三级一区二区| 欧美午夜精品一区| 欧美日韩在线一区二区| 欧美吻胸吃奶大尺度电影| 91美女片黄在线| 日本精品一区二区三区高清 | 欧美性大战久久久久久久| 在线看日本不卡| 在线日韩国产精品| 在线观看欧美日本| 欧美日韩国产中文| 欧美一区二区美女| 日韩欧美一卡二卡| 精品免费一区二区三区| 久久美女高清视频| 国产欧美1区2区3区| 国产精品色哟哟网站| 最新日韩av在线| 亚洲精品国产品国语在线app| 亚洲伦理在线免费看| 亚洲综合一二区| 三级不卡在线观看| 经典三级视频一区| 成人av网站免费| 欧美午夜免费电影| 精品国产乱码久久久久久老虎| 久久久国产精品午夜一区ai换脸| 国产精品久久久久9999吃药| 亚洲乱码国产乱码精品精可以看 | ...xxx性欧美| 亚洲成人手机在线| 精品在线观看免费| 99精品久久99久久久久| 欧美三级中文字幕在线观看| 精品三级av在线| 国产精品久线观看视频| 亚洲国产精品麻豆| 国产精品亚洲综合一区在线观看| 成人视屏免费看| 在线观看91av| 中文字幕免费一区| 亚洲bdsm女犯bdsm网站| 国产一区二区伦理| 色婷婷av一区二区三区gif| 在线播放视频一区| 中文av一区特黄| 青草av.久久免费一区| av一区二区三区在线| 欧美电影一区二区| 中文字幕日韩一区二区| 六月丁香婷婷色狠狠久久| 94色蜜桃网一区二区三区| 日韩午夜av一区| 亚洲欧美另类小说视频| 国产综合色在线视频区| 欧美视频精品在线观看| 日本一区二区三区在线不卡| 日韩一区精品视频| 成人av在线观| 精品久久国产字幕高潮| 亚洲与欧洲av电影| 福利视频网站一区二区三区| 欧美一区二区福利在线| 亚洲三级在线观看| 国产福利一区在线| 欧美一区二区成人6969| 最好看的中文字幕久久| 国产精品一品视频| 日韩欧美亚洲另类制服综合在线| 亚洲欧美另类久久久精品| 国产乱码精品1区2区3区| 欧美高清精品3d| 亚洲午夜精品17c| 成人av中文字幕| 久久久久久97三级| 狠狠色丁香久久婷婷综| 91 com成人网| 亚洲综合视频在线观看| 91亚洲精品久久久蜜桃网站| 国产精品视频在线看| 国产精品一区专区| 欧美成人精品福利| 免费av成人在线| 91精品国产综合久久久蜜臀粉嫩| 亚洲乱码国产乱码精品精小说| 成人av免费在线播放| 中文字幕欧美日韩一区| 成人美女视频在线看| 国产视频一区在线播放| 国产成人丝袜美腿| 国产欧美一区二区三区在线看蜜臀 | 99久久精品99国产精品| 国产精品久久久久影院亚瑟| 国产夫妻精品视频| 国产欧美一区二区在线观看| 国产成人精品1024| 国产精品全国免费观看高清| 成人精品视频.| 中文字幕精品一区二区三区精品| 国产精品一线二线三线| 国产午夜三级一区二区三| 成人污视频在线观看| 中文字幕亚洲电影| 色婷婷av一区二区三区之一色屋| 亚洲精品免费在线观看| 在线免费观看日本一区| 午夜国产精品影院在线观看| 欧美一区二区三区日韩| 韩国视频一区二区| 欧美经典一区二区| 91香蕉视频污在线| 亚洲成人综合视频| 日韩欧美成人一区| 国产盗摄视频一区二区三区| 国产欧美日韩亚州综合| 91在线你懂得| 日韩国产欧美在线播放| 2020国产精品自拍| av午夜一区麻豆| 亚洲成人免费视频| 欧美精品一区二区三区蜜桃| 99久久综合国产精品| 亚洲大片免费看| 欧美tk—视频vk| 99精品视频在线观看免费| 亚洲制服丝袜av| 久久久久亚洲综合| 色婷婷久久一区二区三区麻豆| 日韩电影在线一区二区三区|