use of permafrost.tundra.zip.ZipEntryWithData in project Tundra by Permafrost.
the class zip method decompress.
public static final void decompress(IData pipeline) throws ServiceException {
// --- <<IS-START(decompress)>> ---
// @subtype unknown
// @sigtype java 3.5
// [i] object:0:optional $contents.zip
// [i] field:0:optional $encoding
// [i] field:0:optional $mode {"stream","bytes","string","base64"}
// [o] record:1:optional $contents
// [o] - field:0:required name
// [o] - object:0:required content
IDataCursor cursor = pipeline.getCursor();
try {
Object input = IDataHelper.get(cursor, "$contents.zip");
Charset charset = IDataHelper.get(cursor, "$encoding", Charset.class);
ObjectConvertMode mode = IDataHelper.get(cursor, "$mode", ObjectConvertMode.class);
ZipEntryWithData[] entries = ZipHelper.decompress(InputStreamHelper.normalize(input, charset));
IDataHelper.put(cursor, "$contents", ZipEntryWithData.toIDataArray(entries, charset, mode), false);
} catch (IOException ex) {
ExceptionHelper.raise(ex);
} finally {
cursor.destroy();
}
// --- <<IS-END>> ---
}
Aggregations