WEB开发网
开发学院手机开发Android 开发 Android Java压缩Zlib,Gzip,Zip支持J2ME 阅读

Android Java压缩Zlib,Gzip,Zip支持J2ME

 2010-11-05 00:54:54 来源:WEB开发网   
核心提示:if("ZIP".equals(sys_compress)){temp = ZipUtil.zip(bContent);}MapServerLog.afterMethod();return temp;}catch (IOException e){MapServerLog.exceptionMetho

if("ZIP".equals(sys_compress))

{

temp = ZipUtil.zip(bContent);

}

MapServerLog.afterMethod();

return temp;

}

catch (IOException e)

{

MapServerLog.exceptionMethod(e);

e.printStackTrace();

}

MapServerLog.afterMethod();

return null;

}

public static byte[] inflate(byte[] bContent)

{

MapServerLog.beforeMethod();

try

{

String sys_compress = ConfigRes.getInstance().get(Const.SYS_COMPRESS);

byte[] temp = null;

if("LZIP".equals(sys_compress))

{

temp = ZipUtil.unZLib(bContent);

}

else

if("GZIP".equals(sys_compress))

{

temp = ZipUtil.unGZip(bContent);

}

else

if("ZIP".equals(sys_compress))

{

temp = ZipUtil.unZip(bContent);

}

MapServerLog.afterMethod();

return temp;

}

catch (IOException e)

{

MapServerLog.exceptionMethod(e);

e.printStackTrace();

}

MapServerLog.afterMethod();

return null;

}

// 输入数据的最大长度

private static final int MAXLENGTH = 102400;

// 设置缓存大小

private static final int BUFFERSIZE = 1024;

// 压缩选择方式:

//

// /** Try o get the best possible compression */

// public static final int COMPRESSION_MAX = JZlib.Z_BEST_COMPRESSION;

//

// /** Favor speed over compression ratio */

// public static final int COMPRESSION_MIN = JZlib.Z_BEST_SPEED;

//

// /** No compression */

// public static final int COMPRESSION_NONE = JZlib.Z_NO_COMPRESSION;

//

上一页  1 2 3 4 5 6  下一页

Tags:Android Java 压缩

编辑录入:coldstar [复制链接] [打 印]
赞助商链接