java.io.IOException: FAILED_TO_UNCOMPRESS(5)
at org.xerial.snappy.SnappyNative.throw_error(SnappyNative.java:84)
at org.xerial.snappy.SnappyNative.rawUncompress(Native Method)
at org.xerial.snappy.Snappy.rawUncompress(Snappy.java:444)
at org.xerial.snappy.Snappy.uncompress(Snappy.java:480)
at org.xerial.snappy.Snappy.uncompress(Snappy.java:456)
the code:
String input = "/Users/wangfeng/Downloads/202fe31644d440480ac82795b70a585a.jpg";
FileInputStream is=LocalFileService.getFileInputSteam(input);
System.out.println("raw:"+new File(input).length());
String output="/Users/wangfeng/Downloads/202fe31644d440480ac82795b70a585a.jpg.snappy";
FileOutputStream os=new FileOutputStream(output);
byte[] buffer=new byte[1*1024*1024];
byte[] snappy=null;
while(is.read(buffer)!=-1){
snappy=Snappy.compress(buffer);
buffer=new byte[1*1024*1024];
os.write(snappy);
os.flush();
}
is.close();
os.close();
System.out.println("compressed:"+new File(output).length());
input="/Users/wangfeng/Downloads/202fe31644d440480ac82795b70a585a.jpg.snappy";
output="/Users/wangfeng/Downloads/2222.jpg";
is=LocalFileService.getFileInputSteam(input);
System.out.println("compressed:"+new File(input).length());
os=new FileOutputStream(output);
buffer=new byte[1*1024*1024];
snappy=null;
while(is.read(buffer)!=-1){
snappy=Snappy.uncompress(buffer);// exception thrown
buffer=new byte[1*1024*1024];
os.write(snappy);
os.flush();
}
is.close();
os.close();
System.out.println("uncompressed:"+new File(output).length());
Visit this group at http://groups.google.com/group/xerial.--
You received this message because you are subscribed to the Google Groups "Xerial" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xerial+un...@googlegroups.com.
To post to this group, send email to xer...@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Xerial" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xerial/Qt2E-CG57qk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xerial+un...@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Xerial" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xerial/Qt2E-CG57qk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xerial+un...@googlegroups.com.