ZipException creating zip file
I am trying to modify a zip file, by creating a new zip file and copying the entries over selectively. I use the following code:
try
zipFile = new ZipFile(args[0]);
zos = new ZipOutputStream(new FileOutputStream(args[1]));
entries = zipFile.entries();
while(entries.hasMoreElements())
entry = (ZipEntry)entries.nextElement();
if (entry.getName().endsWith(".class") || entry.isDirectory() ||
entry.getName().endsWith(".MF"))
zos.putNextEntry(entry);
zipFile.close();
zos.close();
catch (IOException ioe)
System.err.println("Unhandled exception:");
ioe.printStackTrace();
System.err.println(entry);
return;
However it throws an exception for the second entry that it encounters:
invalid entry size (expected 10804 but got 0 bytes)
at java.util.zip.ZipOutputStream.closeEntry(Unknown Source)
at java.util.zip.ZipOutputStream.putNextEntry(Unknown Source)
at delPNGsFromJar.main(delPNGsFromJar.java:34)
It doesn't matter which entry it is, it always fails on the seconds.
Anyone have any ideas?
A ZipEntry only contains data associated with the entry, it does not contain any actual data. In addition to putting an entry with "putNextEntry" you have to write its data.
You do this by getting the entry's InputStream from the ZipFile object, and writing what you read from it to the ZipOutputStream. Don't forget to close the entry when you're done.
Similar Messages
-
Error when creating ZIP file (return value 2 when IGS was called)
Hello All
I attempted to Schedule a Query to the Portal folders and executes fine. However when it's scheduled to and email, I am getting this message
'Error when creating ZIP file (return value 2 when IGS was called)'
Any ideas?
Thanks ...BKHello Kai
Thanks very much for the info. how would I know what patch the IGS is?
Thank you.
Regards..BK -
Want To create Zip file using java,And Unzip without Java Program
I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
Here is one answer But I want to open that file normal way(
For Exp. using winzip we can create a zip file and also open simply)
http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0Thanks for your Reply,
I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
import java.io.*;
import java.util.zip.*;
public class ZipFileCreation
public static void main (String argv[])
try {
FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
ZipOutputStream zip = new ZipOutputStream ( fos );
zip.setLevel( 9 );
zip.setMethod( ZipOutputStream.DEFLATED );
// get the element file we are going to add, using slashes in name.
String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
File elementFile = new File ( elementName );
// create the entry
ZipEntry entry = new ZipEntry( elementName );
entry.setTime( elementFile.lastModified() );
// read contents of file we are going to put in the zip
int fileLength = (int)elementFile.length();
System.out.println("fileLength = " +fileLength);
FileInputStream fis = new FileInputStream ( elementFile );
byte[] wholeFile = new byte [fileLength];
int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
// checking bytesRead not shown.
fis.close();
// no need to setCRC, or setSize as they are computed automatically.
zip.putNextEntry( entry );
// write the contents into the zip element
zip.write( wholeFile , 0, fileLength );
zip.closeEntry(); System.out.println("Completed");
// close the entire zip
catch(Exception e) {
e.printStackTrace();
} -
Creating zip files in pl/sql.
I'm using code posted on this forum to create zip file in pl/sql. Works greate for combing multiple files into one archive. That's until I have to add a zip file.
Here's my test:
drop table t1;
create table t1 (file_name varchar2(100), file_blob blob);
declare
v_new_blob blob;
v_file_name varchar2(100);
v_buffer_raw raw(1000);
v_length integer;
b_zipped_blob BLOB;
zip_files zz_zip.file_list;
t_file blob;
begin
dbms_lob.createtemporary(v_new_blob,true);
v_buffer_raw := UTL_RAW.cast_to_raw('AAAA');
v_length := UTL_RAW.length(v_buffer_raw);
dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
insert into t1 values ('tmp\FileA.txt',v_new_blob);
dbms_lob.freetemporary(v_new_blob);
dbms_lob.createtemporary(v_new_blob,true);
v_buffer_raw := UTL_RAW.cast_to_raw('BBBBBBBBB');
v_length := UTL_RAW.length(v_buffer_raw);
dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
insert into t1 values ('tmp\FileB.txt',v_new_blob);
dbms_lob.freetemporary(v_new_blob);
dbms_lob.createtemporary(v_new_blob,true);
v_buffer_raw := UTL_RAW.cast_to_raw('CCCCCCCCCCCCC');
v_length := UTL_RAW.length(v_buffer_raw);
dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
insert into t1 values ('tmp\FileC.txt',v_new_blob);
dbms_lob.freetemporary(v_new_blob);
dbms_lob.createtemporary(v_new_blob,true);
v_buffer_raw := UTL_RAW.cast_to_raw('DDDDDDDDDDDDDDDDDDDDDDDDDD');
v_length := UTL_RAW.length(v_buffer_raw);
dbms_lob.writeappend(v_new_blob, v_length, v_buffer_raw);
insert into t1 values ('tmp\FileD.txt',v_new_blob);
dbms_lob.freetemporary(v_new_blob);
commit;
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'tmp\FileA.txt';
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'tmp\FileB.txt';
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'tmp\FileC.txt';
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
zz_zip.finish_zip(b_zipped_blob);
zip_files := zz_zip.get_file_list( b_zipped_blob );
for i in zip_files.first() .. zip_files.last
loop
dbms_output.put_line( zip_files( i ) );
end loop;
dbms_output.put_line('--');
-- Output
FileA.txt
FileB.txt
FileC.txt
-- Save zip in t1
insert into t1 values ('ZipZZ.zip',b_zipped_blob);
commit;
-- Create new zip file and add ZipZZ.zip and FileD.txt
b_zipped_blob := null;
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'ZipZZ.zip';
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'tmp\FileD.txt';
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
zz_zip.finish_zip(b_zipped_blob);
zip_files := zz_zip.get_file_list( b_zipped_blob );
for i in zip_files.first() .. zip_files.last
loop
dbms_output.put_line( zip_files( i ) );
end loop;
dbms_output.put_line('--');
/* output
ZipZZ.zip
tmp\FileD.txt
-- save ZipXX.zip
insert into t1 values ('ZipXX.zip',b_zipped_blob);
commit;
end;
--Test with other zip files.
insert into t1 values ('File1.zip',null);
commit;
-- I've created a small zip file File1.zip using Winzip. It contains only 1 small text file File1.txt
-- I use toad to insert into blob column.
declare
v_new_blob blob;
v_file_name varchar2(100);
v_buffer_raw raw(1000);
v_length integer;
b_zipped_blob BLOB;
zip_files zz_zip.file_list;
t_file blob;
begin
select file_name, file_blob into v_file_name, v_new_blob
from t1 where file_name = 'File1.zip';
dbms_output.put_line('Blob length: '||dbms_lob.getlength(v_new_blob));
zz_zip.add1file(b_zipped_blob, v_file_name, v_new_blob);
zz_zip.finish_zip(b_zipped_blob);
zip_files := zz_zip.get_file_list( b_zipped_blob );
for i in zip_files.first() .. zip_files.last
loop
dbms_output.put_line( zip_files( i ) );
end loop;
dbms_output.put_line('--');
-- save new file as Zip1.zip
insert into t1 values ('ZipFF.zip',b_zipped_blob);
commit;
end;
Output
Blob length: 1855
File1.zip
File1.txt
Now, new zip file contains both File1.zip and File.txt.
My expected result was just File1.zip
Thanks.Your first example looks like I would expect (or do I miss something?).
Your second example is strange, but it I can't reproduce it. If I zip a zipfile with my package it contains only the zipfile:
declare
my_zip blob;
new_zip blob;
zip_files as_zip.file_list;
function file2blob(
p_dir in varchar2
, p_file_name in varchar2
return blob
is
file_lob bfile;
file_blob blob;
begin
file_lob := bfilename( p_dir
, p_file_name
dbms_lob.open( file_lob
, dbms_lob.file_readonly
dbms_lob.createtemporary( file_blob
, true
dbms_lob.loadfromfile( file_blob
, file_lob
, dbms_lob.lobmaxsize
dbms_lob.close( file_lob );
return file_blob;
exception
when others
then
if dbms_lob.isopen( file_lob ) = 1
then
dbms_lob.close( file_lob );
end if;
if dbms_lob.istemporary( file_blob ) = 1
then
dbms_lob.freetemporary( file_blob );
end if;
raise;
end;
begin
my_zip := file2blob( 'MY_DIR', 'as_fop.zip' );
dbms_output.put_line('zip file to start with');
zip_files := as_zip.get_file_list( my_zip );
for i in zip_files.first() .. zip_files.last
loop
dbms_output.put_line( zip_files( i ) );
end loop;
dbms_output.put_line('--');
-- now create a new zip file containing the existing zip file as_fop.zip
as_zip.add1file( new_zip, 'as_fop.zip', my_zip );
as_zip.finish_zip( new_zip );
-- see what's in the new zip
dbms_output.put_line('zip file containing a zipfile');
zip_files := as_zip.get_file_list( new_zip );
for i in zip_files.first() .. zip_files.last
loop
dbms_output.put_line( zip_files( i ) );
end loop;
dbms_output.put_line('--');
end;
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
zip file to start with
as_fop.sql
zip file containing a zipfile
as_fop.zip
PL/SQL procedure successfully completed.
ANTON@XE>Anton -
Create Zip File In Windows and Extract Zip File In Linux
I had created a zip file (together with directory) under Windows as follow (Code are picked from [http://www.exampledepot.com/egs/java.util.zip/CreateZip.html|http://www.exampledepot.com/egs/java.util.zip/CreateZip.html] ) :
package sandbox;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
* @author yan-cheng.cheok
public class Main {
* @param args the command line arguments
public static void main(String[] args) {
// These are the files to include in the ZIP file
String[] filenames = new String[]{"MyDirectory" + File.separator + "MyFile.txt"};
// Create a buffer for reading the files
byte[] buf = new byte[1024];
try {
// Create the ZIP file
String outFilename = "outfile.zip";
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
// Compress the files
for (int i=0; i<filenames.length; i++) {
FileInputStream in = new FileInputStream(filenames);
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(filenames[i]));
// Transfer bytes from the file to the ZIP file
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
// Complete the entry
out.closeEntry();
in.close();
// Complete the ZIP file
out.close();
} catch (IOException e) {
e.printStackTrace();
The newly created zip file can be extracted without problem under Windows, by using [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html]
However, I realize if I extract the newly created zip file under Linux, using modified version of [http://www.exampledepot.com/egs/java.util.zip/GetZip.html|http://www.exampledepot.com/egs/java.util.zip/GetZip.html] . The original version doesn't check for directory using zipEntry.isDirectory()).public static boolean extractZipFile(File zipFilePath, boolean overwrite) {
InputStream inputStream = null;
ZipInputStream zipInputStream = null;
boolean status = true;
try {
inputStream = new FileInputStream(zipFilePath);
zipInputStream = new ZipInputStream(inputStream);
final byte[] data = new byte[1024];
while (true) {
ZipEntry zipEntry = null;
FileOutputStream outputStream = null;
try {
zipEntry = zipInputStream.getNextEntry();
if (zipEntry == null) break;
final String destination = Utils.getUserDataDirectory() + zipEntry.getName();
if (overwrite == false) {
if (Utils.isFileOrDirectoryExist(destination)) continue;
if (zipEntry.isDirectory())
Utils.createCompleteDirectoryHierarchyIfDoesNotExist(destination);
else
final File file = new File(destination);
// Ensure directory is there before we write the file.
Utils.createCompleteDirectoryHierarchyIfDoesNotExist(file.getParentFile());
int size = zipInputStream.read(data);
if (size > 0) {
outputStream = new FileOutputStream(destination);
do {
outputStream.write(data, 0, size);
size = zipInputStream.read(data);
} while(size >= 0);
catch (IOException exp) {
log.error(null, exp);
status = false;
break;
finally {
if (outputStream != null) {
try {
outputStream.close();
catch (IOException exp) {
log.error(null, exp);
break;
if (zipInputStream != null) {
try {
zipInputStream.closeEntry();
catch (IOException exp) {
log.error(null, exp);
break;
} // while(true)
catch (IOException exp) {
log.error(null, exp);
status = false;
finally {
if (zipInputStream != null) {
try {
zipInputStream.close();
} catch (IOException ex) {
log.error(null, ex);
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException ex) {
log.error(null, ex);
return status;
*"MyDirectory\MyFile.txt" instead of MyFile.txt being placed under folder MyDirectory.*
I try to solve the problem by changing the zip file creation code to
+String[] filenames = new String[]{"MyDirectory" + "/" + "MyFile.txt"};+
But, is this an eligible solution, by hard-coded the seperator? Will it work under Mac OS? (I do not have a Mac to try out)
p/s To be honest, I do a cross post at [http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux|http://stackoverflow.com/questions/2549766/create-zip-file-in-windows-and-extract-zip-file-in-linux] Just want to get more opinion on this.
Edited by: yccheok on Apr 26, 2010 11:41 AMYour solution lies in the File.separator constant; this constant will contain the path separator that is used by the operating system. No need to hardcode one, Java already has it.
edit: when it comes to paths by the way, I have the bad habit of always using the front slash ( / ). This will also work under Windows and has the added benefit of not needing to be escaped. -
Want to view the created zip file via Bursting in Oracle Apps
Hello,
I' ve created a Bursting control file and invoked the concurrent request (XML Publisher Report Bursting Program, XDOBURSTREP) within the after-report trigger in oracle reports.
My Bursting-Control file as follows:
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi" type="bursting">
<xapi:request select="/XXMI_OM_QUOTE/LIST_G_ORDERS/G_ORDERS">
<xapi:delivery>
<xapi:filesystem id="file1" output="/usr/tmp/DEV1/${QUOTE_NO}"></xapi:filesystem>
</xapi:delivery>
<xapi:document output-type="pdf" delivery="123">
<xapi:template type="xsl-fo" location="xdo://XXMI.XXMI_OM_QUOTE.en.US">
</xapi:template>
</xapi:document>
</xapi:request>
</xapi:requestset>
It works fine. e.g. Bursting creates two pdf-files and one zip file in unix, which I can see when pushing the View Output of the request(XML Publisher Report Bursting Program):
<?xml version="1.0" encoding="UTF-8" ?>
- <BURS_REPORT>
<REQUESTID>643527</REQUESTID>
<PARENT_REQUESTID>643525</PARENT_REQUESTID>
<REPORT_DESC>XXMI OM Quote</REPORT_DESC>
<OUTPUT_FILE>/u00/erp/dev1APP/inst/apps/DEV1/logs/appl/conc/out/o643527.zip</OUTPUT_FILE>
- <DOCUMENT_STATUS>
<KEY />
<OUTPUT_TYPE>pdf</OUTPUT_TYPE>
<DELIVERY>FILESYSTEM</DELIVERY>
<OUTPUT>/usr/tmp/DEV1/10000012.pdf</OUTPUT>
<STATUS>success</STATUS>
<LOG />
</DOCUMENT_STATUS>
- <DOCUMENT_STATUS>
<KEY />
<OUTPUT_TYPE>pdf</OUTPUT_TYPE>
<DELIVERY>FILESYSTEM</DELIVERY>
<OUTPUT>/usr/tmp/DEV1/10000026.pdf</OUTPUT>
<STATUS>success</STATUS>
<LOG />
</DOCUMENT_STATUS>
</BURS_REPORT>
But instead of this XML-output I wish a link to the file on unix. How can I link <OUTPUT_FILE>/u00/erp/dev1APP/inst/apps/DEV1/logs/appl/conc/out/o643527.zip</OUTPUT_FILE> within the view Output-Button of this request?
Thanks in advance for any cluesThat is not how bursting works in EBS.
The View Output from XDOBURSTREP is the Bursting Status Reprot.
The bursted results are (potentially) multiple files so cannot be linked to view output.
Depending upon the delivery channel chosen you have to either read the email, check the fiel system or printer, to see the results.
The delivery channel bypasses the standard EBS request view.
Kevin -
Problem in creating zip file.
Hi,
I am using the zip package to create a zip file.The code is given below :
ZipOutputStream out = new ZipOutputStream(new
BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
byte[] data = new byte[1000];
BufferedInputStream in = new BufferedInputStream
(new FileInputStream("d:\\abc\\xyz.log"));
int count;
out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
while((count = in.read(data,0,1000)) != -1)
out.write(data, 0, count);
in.close();
out.flush();
out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
Could you please suggest me a solution so that it zips file from any location. Thanks in advance.BRAVO wrote:
Hi,
I am using the zip package to create a zip file.The code is given below :
ZipOutputStream out = new ZipOutputStream(new
BufferedOutputStream(new FileOutputStream("d:\\abc\\target.zip")));
byte[] data = new byte[1000];
BufferedInputStream in = new BufferedInputStream
(new FileInputStream("d:\\abc\\xyz.log"));
int count;
out.putNextEntry(new ZipEntry("d:\\abc\\target.zip"));
while((count = in.read(data,0,1000)) != -1)
out.write(data, 0, count);
in.close();
out.flush();
out.close();The problem is that the zip file created is having no files when i try to zip files from locations other than the program file location ie other than current drive.
Could you please suggest me a solution so that it zips file from any location. Thanks in advance.My advice would be to tryout something as given below and checkout whether that can
a). Give you Exception Message/stack trace if an error has occured
b). Check whether the appropriate code change works
public compressFile(String inputFile,String destFile){
ZipOutputStream out = null;
byte[] data = null;
BufferedInputStream in = null;
try{
out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destFile)));
data = new byte[1024];
try{
in = new BufferedInputStream(new FileInputStream(inputFile));
int count = -1;
out.putNextEntry(new ZipEntry(inputFile));
while((count = in.read(data)) > 0){
out.write(data, 0, count);
}catch(Exception e){
System.err.println(e.getMessage());
e.printStackTrace();
}finally{
if(in != null)
try{in.close();}catch(Exception ex){}
out.flush();
}catch(Exception exp){
System.err.println(exp.getMessage());
exp.printStackTrace();
}finally{
if(out != null)
try{out.close();}catch(Exception e){}
out = null;
in = null;
}in order to compress the file we can call the method something like
compressUtilObj.compressFile("d:\\abc\\target.zip","d:\\abc\\xyz.log");Hope that helps :)
REGARDS,
RaHuL -
Creating zipped file which contain multiple files
hi all,
i have a problem which i would like some advice about:
i need to recieve from a FTP server multiple files and then zip them all in one big zip file.
now i checked the forums and all i found is using PayloadZipBean which in all the examples create a zip file with one .txt in it.
is it possible to create multiple files in the zip using this module?
another problem if the one big zip file is what if each of the files inside the zip file has it's own mapping...
i think a BPM is a must here and a parallel one also with a correlation...
i would like if it's possible to do something different as the correlation between the files is a bit complicated?
regards and thanks a lot,
Roi GrosfeldFirst,
I would like to understand your requirement. Is it to only download and zip the files in to one file? XI is not the solution. A OS level script or some C program is what I would use for that which calls some FTP APIs.
If you requirement is to get different files with different format but want to send them to one desintation which accepts files in only one format, I would not consider zipping them into one file and again unzipping then and executing a mapping XI. Instead, I would have different file adapter for each type of the file and use as many sender agreements with diffrent mappings.
Hope it made some sense..!!
VJ -
Creating ZIP files of iPhoto 08 albums
Very simply, how can I create a ZIP file of an iPhoto 08 album so that the pictures can be emailed?
Very simply,
Select the pic in the iPhoto Window and go File -> Export and export them to a Folder on the desktop. Zip and email that.
Regards
TD -
I created a zip file by clicking on "Creative Archive," but the file size is still the same. Am I doing something wrong or is there another way to shrink the file size?
Hi astinn,
What type of file you're trying to compress and what type of compression program you're using makes a lot of difference.
As a quick test, I zipped a handful of PDF files on my drive. The resulting .zip file was indeed not much different than the total of the originals. What the PDF contains would also make a difference. If it's mostly just text, than the PDF is already highly compressed. If it has images in it, then it depends on if they're high res (300 dpi) press ready images, which will compress quite a bit, or already highly compressed embedded JPEGs.
Zip is very good at some things, not very good at others. Likewise with Stuffit. It can't compress things like Windows .wmf files at all. Whereas RAR will cut the size of that same file by about half. -
Failed to create zip file - did not free space
Hi,I tried to zip the inside of my camera folder and naturally did not have enough space.1. Creation of the zip file failed.2. Shows me that there is no more room left on device, i.e. the space was not freed.3. Can not locate the zip file it tried to create (it did not appear in the same folder as "camera" and can't find it anywhere else either). Can anyone help, please, can't copy files anywhere because no space left and don't want to delete anything. Thanks in advance,Dario
In regards to your original problem, but I can see two solutions without Link. 1, get an SD card and transfer some content over. The phone has finite space and this is the only way you can access storage from a computer without Link, so it is then only way to back up files (did I mention that is important yet?). 2, download Ghost Commander from the app world. It is a vastly more powerful file browser that can allow you to see your device storage particulars. I have none idea where a temporary ZIP file is located however, so this is not choice #1.
-
Image Capture creating zip files instead of regular files
I've been using Image Capture for many years. For some reason, all of a sudden, all my scans are being put into a zip file instead of as a regular file. I'd like to have Image Capture make regular files again such as pdf etc. What do I do?
Does this have anything to do with going to OS Yosemite 10.10?Hi
appzapper & such are pretty flaky at removing things usefully, imo.
Use the uninstaller for speed download - http://www.yazsoft.com/products/speed-download/faqs/?how-to-un-install-speed-dow nload-properly
or get a hold of FindAnyFile or easyfind & search for Growl & Speeddownload & yazsoft - but from all I hear, the uninstaller works fine.
Failing that, Safari's settings plist file isn't in caches
Home/Library/Preferences/com.apple.safari.plist
is the place
& if you're still stuck, test & maybe download another browser using a New User Account. -
Gurus,
I need to zip a folder using the Oracle Code.
Is it possible to do that?
If it is possible please give your sugessions.
Thanks in Advance.
VenuThe above link is a HOWTO entry and not a "known bug".You are right: maybe it is more of a restriction than a bug.
Anyway, I tried the following which works per se, but the output is not a valid zip file, eventhough the data is compressed.
For compression I did:
DECLARE
f UTL_FILE.file_type;
compressed BLOB;
uncompressed BLOB := UTL_RAW.cast_to_raw ('HelloWorld');
BEGIN
f := UTL_FILE.fopen ('TEMP', 'HelloWorld.zip', 'wb');
DBMS_LOB.createtemporary (compressed, FALSE);
UTL_COMPRESS.lz_compress (uncompressed, compressed, 6);
UTL_FILE.put_raw (f, compressed);
UTL_FILE.fclose (f);
DBMS_LOB.freetemporary (compressed);
END;For uncompression I did:
DECLARE
f UTL_FILE.file_type;
compressed BLOB;
uncompressed BLOB;
fexists BOOLEAN;
file_length NUMBER;
block_size BINARY_INTEGER;
BEGIN
UTL_FILE.fgetattr ('TEMP',
'HelloWorld.zip',
fexists,
file_length,
block_size
f := UTL_FILE.fopen ('TEMP', 'HelloWorld.zip', 'rb');
UTL_FILE.get_raw (f, compressed, file_length);
uncompressed := UTL_COMPRESS.lz_uncompress (compressed);
DBMS_OUTPUT.put_line (UTL_RAW.cast_to_varchar2 (uncompressed));
UTL_FILE.fclose (f);
END;As said, you can read and write from the "zip" file, but no file listing (as you noted yourself) is available. But maybe, if one elaborates more on this, one can modify the bytestream to add some zip headers to make the file zip-compatible ... -
Creating zip-files from within Bridge?
Is there anybody who has got a script that works with Bridge CS5.5?
I got only this, but it appears not to work with my Bridge CS5.5: http://forums.adobe.com/message/3568148#3568148
Anybody can help?Hmm,
today I started it up and there is no error message anymore. I can activate the script in Bridge Preferences/Startup Scripts.
The only problem is, I don't know on which part of the program I would find the zip action now...
Anybody has run the script and can tell me where it appears? Is it when I rightclick a file that I can choose to zip it?
Or is it at the same part where I can create a pdf with contact prints?
Thx -
Now I know I can right click and say "Create Archive," but when I do that it never compresses the file as low as I want. Typically only a tiny bit smaller.
I have DropStuff, but that doesn't seem to be doing a much better job.
I have a quicktime movie I want to put onto a 1GB flash drive. The movie is 15.95GB. I'd like to make it less than a GB. Any suggestions?
Thank you.apple3,
When you compress a signal, most compression schemes lose information compared to the original. As a general rule of thumb, the more you compress the signal, the greater the loss of information.
Where there are repeating patterns in the source data, the greater the repetition, the greater your ability to compress it.
Let's do a crude example: You want to compress the novel written by the insane author character in The Shining, where he writes hundreds of pages of a single sentence,"All work and no play makes Jack a dull boy."
Here's a stab at compessing this: 105762(All work and no play makes Jack a dull boy. ) - repeat the following sentence 105762 times. I've captured the repeating pattern, but I'm missing typos, pagination, extra spaces, and the like. Lossy. Is the loss significant? What if Jack were attempting to convey a message with the typos, pagination, spacing, etc? The "true" message would be lost in compression.
-Wayne
Maybe you are looking for
-
Table for Open Order Qty......
Hi Experts, In Sales Order there are multiple schedule line for single item. Where and in which table i can find open qty for order ,material, item and schedule line items. I Want open items for each schedule line. For One vbeln,
-
Cant Sign Into Apple on iPhone
i have a iphone 4 that wont let me sign into my apple account i changed my passcode 4 times and signed in on my mbp but still nothing from the iphone can someone walk me through this?
-
i cant download apps from appstore. it always show err 1004 please try again. what's meaning?
-
I purchased my laptop in July and now the keys m,./ do not work. I would like to send it in for repiars.
-
Need a little help with JAR creation
I've created a JAVA program with the Forte IDE and now I want to make it executable without the IDE. I read on this forum that all I had to do was create a JAR file, so I tried but I get an error (see below). Could someone point out my error please.