Package nexj.core.util

Examples of nexj.core.util.PagedBinary


               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());
               }

               entry.setValue(part.getName(), datum);
            }

            // Process the size entry
            if (sKeySize != null && sKeyContents != null)
            {
               Binary contents = (Binary)entry.getValue(sKeyContents);
               long lContentsSize = (contents != null) ? contents.getSize() : 0;

               if (lValueSize == -1)
               {
                  // Populate the size entry from the Binary's size
                  entry.setValue(sKeySize, sizeType.getConverter(Primitive.LONG).invoke(Primitive.createLong(lContentsSize)));
View Full Code Here

TOP

Related Classes of nexj.core.util.PagedBinary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.