小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

Unity3D使用壓縮和解壓算法的代碼

 kiki的號 2017-04-05
using UnityEngine;using System.Collections;using ICSharpCode.SharpZipLib; using ICSharpCode.SharpZipLib.GZip;using System.IO; using System.Text; using System; public class RecodeAndSave:MonoBehaviour { void Start() { byte[] binary = Encoding.UTF8.GetBytes("你好,我是小小酥.很高興為您服務(wù)"); Debug.Log("原始數(shù)據(jù)是"+Encoding.UTF8.GetString(binary)); byte[] press = Compress(binary); Debug.Log("壓縮后的數(shù)據(jù)是"+Convert.ToBase64String(press)+"長度是"+press.Length); byte[] depress = DeCompress(press); Debug.Log("解壓后的數(shù)據(jù)是"+Encoding.UTF8.GetString(depress)); } byte[] Compress(byte[] binary) { MemoryStream ms = new MemoryStream(); GZipOutputStream gzip = new GZipOutputStream(ms); gzip.Write(binary,0,binary.Length); gzip.Close(); byte[] press = ms.ToArray(); return press; } byte[] DeCompress(byte[] press) { GZipInputStream gzi = new GZipInputStream(new MemoryStream(press)); MemoryStream re = new MemoryStream(); int count = 0; byte[] data = new byte[4096]; while((count=gzi.Read(data,0,data.Length))!=0) { re.Write(data,0,count); } byte[] depress = re.ToArray(); return depress; }}

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多