Compressed empty bytes need to be Handle

Hello,

I had written a java code in which it handle compressed files in which if byte content is not empty but now I need even though the byte content is empty the data should be decompressed or unzip.Below is the code which is working for unzipped or uncompressed with out empty.

Finally i need an empty bytes to be unzipped

Could any one please help me.

Input: bytes

output:stream

[/code]

public static final void unzipBytesToStream(IData pipeline)
throws ServiceException {
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
Object bytesObj = IDataUtil.get( pipelineCursor, “bytes” );
pipelineCursor.destroy();

	if (!(bytesObj instanceof byte[])) {
		throw new ServiceException("Bytes must be a byte array!");
	}
	try {
		java.util.zip.GZIPInputStream zipIS = new java.util.zip.GZIPInputStream(new ByteArrayInputStream((byte[]) bytesObj));
	
		// pipeline
		pipelineCursor = pipeline.getCursor();
		IDataUtil.put( pipelineCursor, "stream", zipIS );
		pipelineCursor.destroy();
	}
	catch (IOException e) {
		throw new IllegalArgumentException("Invalid content: " + e.getMessage());
	}
}

Hi,

If zip(empty)=empty then unzip(empty)=empty too?

So if you could add a check for an empty input before calling the unzip service, you could return an empty output.

Would this work?

Best Regards,