当前位置: 首页 > news >正文

深圳建设外贸网站微商软件下载

深圳建设外贸网站,微商软件下载,网站制作的销售对象,做网站的素材都在哪里下载这恍恍的天日晒的大地嗞嗞的作响。这湉湉的阴雨下的祖国母亲到处洪水泛滥。人本不该有三六九等#xff0c;可这丑陋的阴雨竟然选择性的泄洪到无辜的县区以示人却有三六九等。谁的财产不是财产#xff0c;谁的生命不是生命#xff1f;谁特妈的不是母亲养大的#xff1f; 一首…这恍恍的天日晒的大地嗞嗞的作响。这湉湉的阴雨下的祖国母亲到处洪水泛滥。人本不该有三六九等可这丑陋的阴雨竟然选择性的泄洪到无辜的县区以示人却有三六九等。谁的财产不是财产谁的生命不是生命谁特妈的不是母亲养大的 一首罗刹海市单曲循环了一周了这调调听的真特么的解恨。与其说是骂娱乐圈的那些营营狗狗可你我为啥不将其骂的范围再上升一个层次呢他到底在骂批判谁或者哪个阶级呢越听越上头越听越觉的骂的很舒服。大抵我等屁民也就这点快感了吧其他的岂敢声张呢 恬不知耻却还能后勇一个屁十字会月薪几十万等这都是什么蝇狗还来呼吁募捐那些年还有些做善事让自己内心温暖的想法或者是举动为的是陶冶自己的情操艹陶冶个驴鸡把生我的和我生的通过自己的努力养好不香吗 刹车 最近因为IM中信令数据过大导致网络层传输数据过大的问题进行了优化原本3M的数据压缩后以400多KB进行传输这也很香当然数据量越大效率越高来吧马户直接吃鸡 头文件实现[内存数据解压缩你可以二次改造为文件目录解压缩] // // NSZip.h // // Created by carbonzhao on 2023/8/1. //#import Foundation/Foundation.h #import zlib.hNS_ASSUME_NONNULL_BEGIN//此类主要为内存压缩非文件目录解压缩。可进行稍微改造实现指定目录文件gzip解压缩此处不实现。 interface NSZip : NSObject(id)zip;//将指定的data进行gzip压缩。若需要进行Zip或者其他类型的压缩请调整deflateInit2函数第4个参数值。 - (NSData *)zip:(NSData *)data error:(NSError **)err;//将指定的数据进行gzip解压缩。 - (NSData *)unZip:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err;(NSData *)unZip:(NSData*)data error:(NSError **)err;//指定sourcePath目录的gzip压缩包解压到destinationPath指定的目录中。用于文件解压缩。(BOOL)unZip:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err; endNS_ASSUME_NONNULL_END.m文件实现 // // NSZip.m // // Created by carbonzhao on 2023/8/1. //#import NSZip.h #define DATA_CHUNK_SIZE 262144interface NSZip () {BOOL zipReady;z_stream zStream; }property (atomic, assign, readonly) BOOL zipReady; endimplementation NSZipsynthesize zipReady; (id)zip {NSZip *zip [[NSZip alloc] init];[zip resetZip];return zip; }- (void)dealloc {if (zipReady){[self closeZip];} }- (NSError *)resetZip {if (zipReady){return nil;}// Setup the inflate streamzStream.zalloc Z_NULL;zStream.zfree Z_NULL;zStream.opaque Z_NULL;zStream.avail_in 0;zStream.next_in 0;int status inflateInit2(zStream, (1532));if (status ! Z_OK){return [[self class] inflateErrorWithCode:status];}zipReady YES;return nil; }- (NSError *)closeZip {if (!zipReady){return nil;}// Close the inflate streamzipReady NO;int status inflateEnd(zStream);if (status ! Z_OK){return [[self class] inflateErrorWithCode:status];}return nil; }- (NSData *)zip:(NSData *)data error:(NSError **)err {if (data data.length 0){zStream.next_in (Bytef *) data.bytes;zStream.avail_in (uInt) data.length;zStream.total_out 0;OSStatus status deflateInit2(zStream,Z_DEFAULT_COMPRESSION,Z_DEFLATED, MAX_WBITS16,MAX_MEM_LEVEL,Z_DEFAULT_STRATEGY); /* 历史缓冲区最大尺寸值为 2^windowBits,windowBits 的值为 8~15 时deflate() 方法生成 zlib 格式的数据当 windowBits 为 31 时 deflate() 方法生成 gzip 格式。当取值为 -15 ~ -8 时deflate() 生成纯 deflate 算法压缩数据不包含 zlib 和 gzip 格式头和尾OSStatus status deflateInit2(zStream, Z_DEFAULT_COMPRESSION,Z_DEFLATED, 31, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);*/if (status ! Z_OK){return nil;}NSInteger kZlibCompressChunkSize 2048;NSMutableData *compressedData [NSMutableData dataWithLength:kZlibCompressChunkSize];do {if ((status Z_BUF_ERROR) || (zStream.total_out compressedData.length)) {[compressedData increaseLengthBy:kZlibCompressChunkSize];}zStream.next_out (Bytef *)compressedData.bytes zStream.total_out;zStream.avail_out (uInt)(compressedData.length - zStream.total_out);status deflate(zStream, Z_FINISH);} while ((status Z_BUF_ERROR) || (status Z_OK));status deflateEnd(zStream);if ((status ! Z_OK) (status ! Z_STREAM_END)) {*err [[self class] inflateErrorWithCode:status];return nil;}compressedData.length zStream.total_out;return compressedData;}return nil; }- (NSData *)unZip:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err {if (length 0) return nil;NSUInteger halfLength length/2;NSMutableData *outputData [NSMutableData dataWithLength:lengthhalfLength];int status;zStream.next_in bytes;zStream.avail_in (unsigned int)length;zStream.avail_out 0;NSUInteger bytesProcessedAlready zStream.total_out;while (zStream.avail_in ! 0){if (zStream.total_out-bytesProcessedAlready [outputData length]) {[outputData increaseLengthBy:halfLength];}zStream.next_out (Bytef*)[outputData mutableBytes] zStream.total_out-bytesProcessedAlready;zStream.avail_out (unsigned int)([outputData length] - (zStream.total_out-bytesProcessedAlready));status inflate(zStream, Z_NO_FLUSH);if (status Z_STREAM_END){break;}else if (status ! Z_OK){if (err){*err [[self class] inflateErrorWithCode:status];}return nil;}}// Set real length[outputData setLength: zStream.total_out-bytesProcessedAlready];return outputData; } (NSData *)unZip:(NSData*)data error:(NSError **)err {NSError *theError nil;NSData *outputData [[NSZip zip] unZip:(Bytef *)[data bytes] length:[data length] error:theError];if (theError){if (err){*err theError;}return nil;}return outputData; } (BOOL)unZip:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err {NSFileManager *fileManager [[NSFileManager alloc] init];// Create an empty file at the destination pathif (![fileManager createFileAtPath:destinationPath contents:[NSData data] attributes:nil]) {if (err){*err [NSError errorWithDomain:NSZipErrorDomain code:11 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:Decompression of % failed because we were to create a file at %,sourcePath,destinationPath],NSLocalizedDescriptionKey,nil]];}return NO;}// Ensure the source file existsif (![fileManager fileExistsAtPath:sourcePath]){if (err){*err [NSError errorWithDomain:NSZipErrorDomain code:11 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:Decompression of % failed the file does not exist,sourcePath],NSLocalizedDescriptionKey,nil]];}return NO;}UInt8 inputData[DATA_CHUNK_SIZE];NSData *outputData;NSInteger readLength;NSError *theError nil;NSZip *decompressor [NSZip zip];NSInputStream *inputStream [NSInputStream inputStreamWithFileAtPath:sourcePath];[inputStream open];NSOutputStream *outputStream [NSOutputStream outputStreamToFileAtPath:destinationPath append:NO];[outputStream open];while ([decompressor zipReady]){// Read some data from the filereadLength [inputStream read:inputData maxLength:DATA_CHUNK_SIZE];// Make sure nothing went wrongif ([inputStream streamStatus] NSStreamStatusError){if (err){*err [NSError errorWithDomain:NSZipErrorDomain code:11 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:Decompression of % failed because we were unable to read from the source data file,sourcePath],NSLocalizedDescriptionKey,[inputStream streamError],NSUnderlyingErrorKey,nil]];}[decompressor closeZip];return NO;}// Have we reached the end of the input data?if (!readLength){break;}// Attempt to inflate the chunk of dataoutputData [decompressor unZip:inputData length:(NSUInteger)readLength error:theError];if (theError){if (err){*err theError;}[decompressor closeZip];return NO;}// Write the inflated data out to the destination file[outputStream write:(Bytef*)[outputData bytes] maxLength:[outputData length]];// Make sure nothing went wrongif ([inputStream streamStatus] NSStreamStatusError) {if (err){*err [NSError errorWithDomain:NSZipErrorDomain code:11 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:Decompression of % failed because we were unable to write to the destination data file at %,sourcePath,destinationPath],NSLocalizedDescriptionKey,[outputStream streamError],NSUnderlyingErrorKey,nil]];}[decompressor closeZip];return NO;}}[inputStream close];[outputStream close];NSError *error [decompressor closeZip];if (error){if (err){*err error;}return NO;}return YES; } (NSError *)inflateErrorWithCode:(int)code {return [NSError errorWithDomain:NSZipErrorDomain code:11 userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:Decompression of data failed with code %d,code],NSLocalizedDescriptionKey,nil]]; } end使用方法 1、gzip压缩[默认为gzip压缩其他压缩看代码注释] //text为NSString类型将其压缩后通过Websocket传输 NSError *err nil; NSData *data [text dataUsingEncoding:NSUTF8StringEncoding]; NSData *zipData [[NSZip zip] zip:data error:err];[weakSelf.linkedSocket sendData:zipData error:nil]; 2、解压 //message为websocket返回的NSData数据进行解压 NSError *err nil; NSData *data [NSZip unZip:message error:err]; if (!err) {NSString *msg [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];//解压后的NSString分发到UI层面进行使用[weakSelf dispatchData:msg]; }
http://www.pierceye.com/news/964741/

相关文章:

  • 怎么做网站视频教程做广告牌子
  • 合肥做网站公网站设网页设计
  • 罗田做网站凡科网小程序
  • 玻璃钢产品哪个网站做推广好.加强网站安全建设
  • 扬州公司网站建设网络建设与管理包括哪些方面
  • 我的网站域名福州网站的优化
  • 威海市网站建设微信在线登录平台
  • 2014网站设计成都网站设计合理柚v米科技
  • 建设自己网站需要多钱网站规划与设计就业
  • 用flash做的网站欣赏手机网站图片切换jquery
  • 昆明做网站seo网站推广策略什么时候
  • 网站添加 百度商桥wordpress 友情链接 代码
  • 一鸿建设设计网站百家号排名
  • 网站最新一次改版时间什么意思电商平台应该如何推广
  • 网站设计制作程序网站开发列表
  • 企业网站建设需要哪些费用做算法的网站
  • 很大气的网站 营销js特效网站展示
  • 南宁建站程序成都新线加网站建设
  • 用微软雅黑做网站可以吗wordpress游客发帖插件
  • 网站备案怎样提交管局网页电商设计
  • 郑州华恩科技做网站怎么样网络竞价推广托管公司
  • 都江堰住房和城乡建设厅网站哈尔滨网站建设方案维护
  • 九江网站网站建设原始传奇经典复古
  • 宽屏营销型网站源码安微省住房和城乡建设厅网站
  • 做暖视频网站免费搜索引擎营销的模式有
  • 网站建设需要的条件榆林北京网站建设
  • 分类信息网站推广的意义wordpress安装教程wamp
  • 免费自助建站全系统建设银行永泰支行网站
  • 建网络商城网站如何开公司做网站
  • 长春网站制作色块网站设计