哪位大虾给一段针对已经压缩的字符串解压缩的代码,谢过了,已经采用,百分相送
解决方案 »
- Delphi中的QRDBText组件如何显示多行数据库字段的内容?
- 100分求 sql类型转换 新手诚邀大侠进来看看!!
- 如何用ADOQUERY1和ADOCONNECTION来做一个远程的备份
- 串口控件安装问题
- 如何才能使Form上的控件与窗体同步变化,保持相对位置不变呢?
- 各位:看看啊!新鲜!MS_SQL与DELPHI将日期转换成整数后相差两天???
- to kmzym 和所有对完成端口和重叠I/O有研究的朋友
- 给数据编号的问题,高手请进。
- ##### 如何让在checklistbox中选中的记录打印到报表中! #####
- 谁开发过电力记费系统方面的软件?
- 在delphi中如何得到数据库记录总数
- edit中的文本居右显示问题?
out OutBuffer: Pointer; OutBytes: Integer);
zlib.DeCompressBuf(const InBufer: pointer; InBytes: integer;
outEstimat: integer;
out OutBuffer: Pointer; OutBytes: Integer);
zlib.DeCompressBuf(const InBufer: pointer; InBytes: integer;
outEstimat: integer;
out OutBuffer: Pointer; OutBytes: Integer);附送java里面的实现:
public class ByteUtils {
public static byte[] compressBytes(byte[] bytes) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(baos));
dos.write(bytes);
dos.close();
return baos.toByteArray();
} public static byte[] decompressBytes(byte[] bytes)
throws IOException
{
GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(
bytes));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int len = -1; while ((len = gis.read(buf)) >= 0)
{
baos.write(buf, 0, len);
} gis.close();
baos.close();
return baos.toByteArray();
}
}
压缩: txtname :='c:\1.txt';
Fzipname :='c:\1.zip';
if FileExists(txtname) then
begin
Fzip.FileName :=Fzipname;
Fzip.AddFiles(txtname, 0);
Fzip.CloseArchive;
end
else begin
application.messagebox(pchar('无法压缩,请检查是否有'+txtname+'这个文件!'),'警告',MB_OK+MB_ICONWARNING);
exit;
end;
解压:
Funzip.BaseDirectory :=ExtractFilePath(Application.Exename);
Funzip.FileName :='c:\1.zip';
Funzip.ExtractFiles('*.*');