while ((zipEntry = zipStream.getNextEntry()) != null)
{
String sKeySize = null;
long lValueSize = 0;
String sKeyContents = null;
Primitive sizeType = null;
TransferObject entry = new TransferObject();
entryList.add(entry);
// Iterate the parts, assigning data from the Zip entry
for (int i = 0; i < entriesPart.getPartCount(); i++)
{
PrimitiveMessagePart part = (PrimitiveMessagePart)entriesPart.getPart(i);
ZipMessagePartMapping mapping = (ZipMessagePartMapping)part.getMapping();
Object datum = null;
Primitive partType = part.getType();
switch (mapping.getValue())
{
case ZipMessagePartMapping.VALUE_CONTENTS:
Binary contents = new PagedBinary(zipStream);
zipStream.closeEntry();
if (s_logger.isDebugEnabled())
{
s_logger.debug("Extracted contents of \"" + zipEntry.getName() + "\" size=" + contents.getSize());
}
if (contents.getSize() > 0)
{
datum = partType.getConverter(Primitive.BINARY).invoke(contents);
}
sKeyContents = part.getName();
break;
case ZipMessagePartMapping.VALUE_COMMENT:
datum = partType.getConverter(Primitive.STRING).invoke(zipEntry.getComment());
break;
case ZipMessagePartMapping.VALUE_DIRECTORY:
datum = partType.getConverter(Primitive.BOOLEAN).invoke(Boolean.valueOf(zipEntry.isDirectory()));
break;
case ZipMessagePartMapping.VALUE_EXTRA:
if (zipEntry.getExtra() != null)
{
datum = partType.getConverter(Primitive.BINARY).invoke(new Binary(zipEntry.getExtra()));
}
break;
case ZipMessagePartMapping.VALUE_NAME:
datum = partType.getConverter(Primitive.STRING).invoke(convertZipSeparatorToPlatformSeparator(zipEntry.getName()));
break;
case ZipMessagePartMapping.VALUE_SIZE:
datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getSize()));
sKeySize = part.getName();
lValueSize = zipEntry.getSize();
sizeType = partType;
break;
case ZipMessagePartMapping.VALUE_TIME:
datum = partType.getConverter(Primitive.LONG).invoke(Primitive.createLong(zipEntry.getTime()));
break;
default:
throw new IllegalStateException("Unknown value: " + mapping.getValue());
}