关于网友提出的“ j2me里有没inflater?”问题疑问,本网通过在网上对“ j2me里有没inflater?”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: j2me里有没inflater?
描述: j2me里有没inflater, deflater等类?
解决方案1: 不懂, 帮顶
解决方案2: 拷贝别人的希望对你有帮助
j2se的压缩:
RandomAccessFile file=null;
byte[] ba=null;
//得到文件内容
try {
file=new RandomAccessFile("./bj.bmp","r");
ba=new byte[(int)file.length()];
file.read(ba);
}
catch (IOException e) {
e.printStackTrace();
}
finally{
if(file!=null){
try {
file.close();
}
catch (IOException e1) {
}
}
}
//开始压缩
byte[] output=new byte[100*1024];
Deflater compresser=new Deflater(Deflater.BEST_COMPRESSION);
compresser.setInput(ba);
compresser.finish();
int compressedDataLength=compresser.deflate(output);
//写出压缩文件
FileOutputStream fos=null;
try {
fos=new FileOutputStream("./bj.bmp.gz");
fos.write(output,0,compressedDataLength);
fos.flush();
}
catch (IOException e2) {
e2.printStackTrace();
}
finally{
if(fos!=null){
try {
fos.close();
}
catch (IOException e3) {
e3.printStackTrace();
}
}
}
解决方案3: google下gzip
解决方案4: 没有
以上介绍了“ j2me里有没inflater?”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1992545.html