Hi Rob,
I think I fixed that problem. I used BufferedInputStream to read the contents of byte array instead InputStream. Here is the new code its works fine now.
String zipFilename = “”;
ZipFile zf = null;
// pipeline
IDataHashCursor pipelineCursor = pipeline.getHashCursor();
if ( pipelineCursor.first( “zipFilename” ) )
{
zipFilename = (String) pipelineCursor.getValue();
}
pipelineCursor.destroy();
Vector entryVector = new Vector();
try
{
zf = new ZipFile(zipFilename);
java.util.Enumeration entries = zf.entries();
ZipEntry ze;
while(entries.hasMoreElements())
{
ze = (ZipEntry)entries.nextElement();
byte[] b = null;
BufferedInputStream is = null;
if(!ze.isDirectory())
{
long entrySize = ze.getSize();
//if(entrySize > Integer.MAX_VALUE)
//throw new ServiceException(ze.getName() + " expands to " + ze.getSize() + " and is too large for this service.");
b = new byte[(int)entrySize];
//InputStream is = zf.getInputStream(ze);
is = new BufferedInputStream(zf.getInputStream(ze));
is.read(b, 0, b.length);
}
IData entry = IDataFactory.create();
IDataHashCursor entryCursor = entry.getHashCursor();
entryCursor.last();
entryCursor.insertAfter(“fileName”, ze.getName());
entryCursor.last();
entryCursor.insertAfter(“isDirectory”, (new Boolean(ze.isDirectory())).toString());
entryCursor.last();
entryCursor.insertAfter(“outputBytes”, b);
entryCursor.destroy();
entryVector.add(entry);
}
}
catch (java.io.IOException ioe)
{
throw new ServiceException("IOException: " + ioe.getMessage());
}
finally
{
if(zf != null)
{
try
{
zf.close();
}
catch (IOException ioe)
{
// Ignore any exceptions from above close
}
zf = null;
}
}
// pipeline
IDataHashCursor pipelineCursor_1 = pipeline.getHashCursor();
pipelineCursor_1.last();
pipelineCursor_1.insertAfter( “entries”, entryVector.toArray());
pipelineCursor_1.destroy();
Thanks for your help,
Muru.