truezip 加强了原有的压缩功能,在创建压缩文件的时候不能在压缩文件里面使用中文的字符下面是truezip发布时提供的例子,修改inner.zip或者hello.txt 文件使他们包含中文字符,编译器报告 文件名中有 非法的字符 有会用的给个解决办法吗?import de.schlichtherle.io.*;
import java.io.PrintStream;public class Main {
public static void main(String[] args) throws Exception {
de.schlichtherle.io.File.setDefaultArchiveDetector(ArchiveDetector.ALL); try {
PrintStream ps = new PrintStream(
//new de.schlichtherle.io.FileOutputStream("./outer.zip"+ //这里可以有中文 "/inner.zip"+ //往里不能出现中文
"/ppp.txt")); //同上
new de.schlichtherle.io.FileOutputStrea("./outer.zip/inner.zip/hello.txt"));
try {
ps.println("Hello, world!");
}
finally {
ps.close();
}
}
finally {
de.schlichtherle.io.File.update();
}
}
}
import java.io.PrintStream;public class Main {
public static void main(String[] args) throws Exception {
de.schlichtherle.io.File.setDefaultArchiveDetector(ArchiveDetector.ALL); try {
PrintStream ps = new PrintStream(
//new de.schlichtherle.io.FileOutputStream("./outer.zip"+ //这里可以有中文 "/inner.zip"+ //往里不能出现中文
"/ppp.txt")); //同上
new de.schlichtherle.io.FileOutputStrea("./outer.zip/inner.zip/hello.txt"));
try {
ps.println("Hello, world!");
}
finally {
ps.close();
}
}
finally {
de.schlichtherle.io.File.update();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货