Package nexj.core.util

Examples of nexj.core.util.Binary


      if (nBytesRead != (int)m_io.length())
      {
         throw new IOException("Read stopped early");
      }
     
      return new Binary(nDataArray);
   }
View Full Code Here


               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

         if (Character.digit((char)m_ch, 16) < 0)
         {
            if (Character.isLetter((char)m_ch))
            {
               fail("err.parser.invalidBinary", null, getCurTokenPos());
               return new Binary(new byte[]{0});
            }

            resetReader();
            break;
         }
View Full Code Here

                  if (binaryValue.length > nMaxLength)
                  {
                     byte[] truncatedValue = new byte[nMaxLength];

                     System.arraycopy(binaryValue, 0, truncatedValue, 0, nMaxLength);
                     validatedValue = new Binary(truncatedValue);

                     if (s_logger.isDebugEnabled())
                     {
                        s_logger.debug("Value of attribute " + attribute.getName()
                           + " has been truncated to maximum allowed length " + nMaxLength
View Full Code Here

      catch (IOException e)
      {
         throw new UncheckedException("err.rpc.valueSerialization", e);
      }
     
      return new Binary(bos.toByteArray());
   }
View Full Code Here

        
         if (sName.equals("object"))
         {
            InstanceList list = null;
            String sClassName = (String)instance.getValue("class");
            Binary serializedOID = (Binary)instance.getValue("oid");
           
            if (sClassName != null && serializedOID != null)
            {
               Metaclass metaclass = m_context.getMetadata().findMetaclass(sClassName);
              
               if (metaclass != null && metaclass.getPersistenceMapping() != null)
               {
                  list = (InstanceList)metaclass.invoke("read",
                     new Object[]{null, new Pair(Symbol.EQ, new Pair(new Pair(Symbol.AT),
                        new Pair(OID.fromBinary(serializedOID)))), null, null, null, null});
               }
            }

            instance.setValue("object", (list == null || list.isEmpty()) ? null : list.get(0));
         }
         else if (sName.equals("values"))
         {
            SerializablePropertyMap map = new GenericSerializablePropertyMap(GenericSerializablePropertyMap.LEAVE);

            map.deserializeValues((String)instance.getValue("serializedValues"), m_context);
            instance.setValue("values", map);
         }
         else if (sName.equals("objectCaption"))
         {
            StringBuffer buf = new StringBuffer(64);
            Object obj = instance.getValue("object");

            if (obj != null)
            {
               appendValue(buf, obj, false);
            }
            else
            {
               Binary serializedOID = (Binary)instance.getValue("oid");

               if (serializedOID != null)
               {
                  buf.append('<');
                  buf.append(OID.fromBinary(serializedOID));
View Full Code Here

         if (nCount > 0)
         {
            System.arraycopy(data, 0, buf, 0, nCount);
         }

         tobj.setValue(JMSSender.BODY, new Binary(buf));
      }
      else if (message instanceof MapMessage)
      {
         MapMessage msg = (MapMessage)message;
         TransferObject map = new TransferObject();
View Full Code Here

         return value;
      }
  
      if (value instanceof byte[])
      {
         return new Binary((byte[])value);
      }
  
      return value;
   }
View Full Code Here

               }
               else
               {
                  if (nOfs == 0 && nCount == data.length)
                  {
                     body = new Binary(data);
                  }
                  else
                  {
                     byte[] buf = new byte[nCount];

                     System.arraycopy(data, nOfs, buf, 0, nCount);
                     body = new Binary(buf);
                  }
               }

               if (m_channel.getQueue() != null)
               {
View Full Code Here

      FileConnection conn = null;

      try
      {
         Object body = tobj.findValue(BODY);
         Binary data;

         if (body == null)
         {
            throw new IntegrationException("err.rpc.file.missingBody",
               new Object[] {m_channel.getName()});
View Full Code Here

TOP

Related Classes of nexj.core.util.Binary

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.