php 的gzinflat功能:
1 |
<?php
eval(gzinflate(base64_decode('7H35m9rItejPd75v/gfSmRvb10uztpvx2Ak7Er
|
2 |
...bla
bla bla.... RGpn/Aw==')));?> |
java实现
1 |
package
base64decoder; |
02 |
03 |
import
java.io.ByteArrayInputStream; |
04 |
import
java.io.File; |
05 |
import
java.io.FileOutputStream; |
06 |
import
java.io.InputStream; |
07 |
import
java.util.Scanner; |
08 |
import
java.util.zip.Inflater; |
09 |
import
java.util.zip.InflaterInputStream; |
10 |
import
org.apache.commons.codec.binary.Base64; |
11 |
12 |
public
class
GZipAndBase64Decoder { |
13 |
14 |
public
static
void
main(String[] args) throws
Exception { |
15 |
Scanner
scanner = new
Scanner(new
File("coded.txt")); |
16 |
String
isi = scanner.nextLine(); |
17 |
InputStream
inflInstream = new
InflaterInputStream( |
18 |
new
ByteArrayInputStream(new
Base64().decode(isi)), |
19 |
new
Inflater(true));//标准不一样 |
20 |
byte
bytes[] = new
byte[4096]; |
21 |
|
22 |
FileOutputStream
fileOutputStream = new
FileOutputStream(new
File("decoded.txt")); |
23 |
|
24 |
while
(true)
{ |
25 |
int
length = inflInstream.read(bytes, 0,
4096); |
26 |
if
(length == -1)
{ |
27 |
break; |
28 |
} |
29 |
fileOutputStream.write(bytes,
0,
length); |
30 |
} |
31 |
fileOutputStream.flush(); |
32 |
fileOutputStream.close(); |
33 |
} |
34 |
} |
本文介绍如何使用PHP的gzinflate函数解压缩数据,并提供了一个Java程序示例来实现类似的功能,包括Base64解码和解压缩。
1万+

被折叠的 条评论
为什么被折叠?



