The following snippet writes the content of a QBuffer to a jar file but while the file size looks ok the jar file is corrupt.
// data is from the type QBuffer *
// fileName is from the type QString
data->open(QIODevice::ReadOnly);
QByteArray feature = data->readAll();
QFile jarfile;
jarfile.setFileName(fileName);
jarfile.open(QIODevice::WriteOnly);
QTextStream fout(&jarfile);
fout << feature << endl;
jarfile.close();
Both, file-roller and jar, could not extract the content. jar returned the following exception:
java.util.zip.ZipException: invalid code lengths set
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:163)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:109)
at sun.tools.jar.Main.extractFile(Main.java:954)
at sun.tools.jar.Main.extract(Main.java:870)
at sun.tools.jar.Main.run(Main.java:260)
at sun.tools.jar.Main.main(Main.java:1167)
The following snippet writes the content of a QBuffer to a jar file but while the file size looks ok the jar file is corrupt.
Both,
file-roller
andjar
, could not extract the content.jar
returned the following exception:Keywords