Hallo ich möchte ein Bild und eine Xml Datei zusammen Zippen. Dazu habe ich bis jetzt folgenden Code.
Mein Problem ist jetzt das er mir sagt The Constructor ZipEntry(BufferedImage) is undefined....
Aber wie kriege ich jetzt aus dem Image nen Input Stream erzeugt???
Mein Problem ist jetzt das er mir sagt The Constructor ZipEntry(BufferedImage) is undefined....
Aber wie kriege ich jetzt aus dem Image nen Input Stream erzeugt???
Java:
static private void writeToZipOutput(String fileName, BufferedImage image, Document doc) {
FileInputStream fis = new FileInputStream(fileName);
ZipEntry entry = new ZipEntry(image);
entry.setTime(f.lastModified());
output.putNextEntry(entry);
copy(fis, output);
output.closeEntry();
fis.close();
}
static private void copy(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[1024];
int bytes;
while ((bytes = is.read(buffer)) > 0) {
os.write(buffer, 0, bytes);
}
}