Vector<Type> types = new Vector<Type>();
/* TODO: put this somewhere else Vector<Type> types = new Vector<Type>();
   private Object extractone(byte[] sigb, byte[] buf, int[] ofs) throws DBusException   {      Debug.print(Debug.DEBUG, "Extracting type: "+((char)sigb[ofs[0]])+" from offset "+ofs[1]);      Object rv = null;      ofs[1] = align(ofs[1], sigb[ofs[0]]);      switch (sigb[ofs[0]]) {         case ArgumentType.BYTE:            rv = buf[ofs[1]++];            break;         case ArgumentType.UINT32:            rv = new UInt32(demarshallint(buf, ofs[1], 4));            ofs[1] += 4;            break;         case ArgumentType.INT32:            rv = (int) demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            break;         case ArgumentType.INT16:            rv = (short) demarshallint(buf, ofs[1], 2);            ofs[1] += 2;            break;         case ArgumentType.UINT16:            rv = new UInt16((int) demarshallint(buf, ofs[1], 2));            ofs[1] += 2;            break;         case ArgumentType.INT64:            rv = demarshallint(buf, ofs[1], 8);            ofs[1] += 8;            break;         case ArgumentType.UINT64:            long top;            long bottom;            if (big) {               top = demarshallint(buf, ofs[1], 4);               ofs[1] += 4;               bottom = demarshallint(buf, ofs[1], 4);            } else {               bottom = demarshallint(buf, ofs[1], 4);               ofs[1] += 4;               top = demarshallint(buf, ofs[1], 4);            }            rv = new UInt64(top, bottom);            ofs[1] += 4;            break;         case ArgumentType.DOUBLE:            long l = demarshallint(buf, ofs[1], 8);            ofs[1] += 8;            rv = Double.longBitsToDouble(l);            break;         case ArgumentType.FLOAT:            int rf = (int) demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            rv = Float.intBitsToFloat(rf);            break;         case ArgumentType.BOOLEAN:            rf = (int) demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            rv = (1==rf)?Boolean.TRUE:Boolean.FALSE;            break;         case ArgumentType.ARRAY:            long size = demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            byte algn = (byte) getAlignment(sigb[++ofs[0]]);            ofs[1] = align(ofs[1], algn);            int length = (int) (size / algn);            if (length > DBusConnection.MAX_ARRAY_LENGTH)               throw new MarshallingException("Arrays must not exceed "+DBusConnection.MAX_ARRAY_LENGTH);            // optimise primatives            switch (sigb[ofs[0]]) {               case ArgumentType.BYTE:                  rv = new byte[length];                  System.arraycopy(buf, ofs[1], rv, 0, length);                  ofs[1] += size;                  ofs[0]++;                  break;               case ArgumentType.INT16:                  rv = new short[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((short[]) rv)[j] = (short) demarshallint(buf, ofs[1], algn);                  ofs[0]++;                  break;               case ArgumentType.INT32:                  rv = new int[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((int[]) rv)[j] = (int) demarshallint(buf, ofs[1], algn);                  ofs[0]++;                  break;               case ArgumentType.INT64:                  rv = new long[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((long[]) rv)[j] = (long) demarshallint(buf, ofs[1], algn);                  ofs[0]++;                  break;               case ArgumentType.BOOLEAN:                  rv = new boolean[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((boolean[]) rv)[j] = (1 == demarshallint(buf, ofs[1], algn));                  ofs[0]++;                  break;               case ArgumentType.FLOAT:                  rv = new float[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((float[]) rv)[j] =                        Float.intBitsToFloat((int)demarshallint(buf, ofs[1], algn));                  ofs[0]++;                  break;               case ArgumentType.DOUBLE:                  rv = new double[length];                  for (int j = 0; j < length; j++, ofs[1] += algn)                      ((double[]) rv)[j] =                        Double.longBitsToDouble(demarshallint(buf, ofs[1], algn));                  ofs[0]++;                  break;               case ArgumentType.DICT_ENTRY1:                  int ofssave = ofs[0];                  long end = ofs[1]+size;                  Vector<Object[]> entries = new Vector<Object[]>();                  while (ofs[1] < end) {                     ofs[0] = ofssave;                     entries.add((Object[]) extractone(sigb, buf, ofs));                  }                  rv = new DBusMap(entries.toArray(new Object[0][]));                  break;               default:                  ofssave = ofs[0];                  end = ofs[1]+size;                  Vector<Object> contents = new Vector<Object>();                  while (ofs[1] < end) {                     ofs[0] = ofssave;                     contents.add(extractone(sigb, buf, ofs));                  }                  rv = contents;            }            break;         case ArgumentType.STRUCT1:            Vector<Object> contents = new Vector<Object>();            while (sigb[++ofs[0]] != ArgumentType.STRUCT2)               contents.add(extractone(sigb, buf, ofs));            ofs[0]++;            rv = contents.toArray();            break;         case ArgumentType.DICT_ENTRY1:            Object[] decontents = new Object[2];            decontents[0] = extractone(sigb, buf, ofs);            ofs[0]++;            decontents[1] = extractone(sigb, buf, ofs);            ofs[0]++;            rv = decontents;            break;         case ArgumentType.VARIANT:            int[] newofs = new int[] { 0, ofs[1] };            String sig = (String) extract(ArgumentType.SIGNATURE_STRING, buf, newofs)[0];            newofs[0] = 0;            rv = new Variant<Object>(extract(sig, buf, newofs)[0] , sig);            ofs[1] = newofs[1];            break;         case ArgumentType.STRING:            length = (int) demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            rv = new String(buf, ofs[1], length);            ofs[1] += length + 1;            break;         case ArgumentType.OBJECT_PATH:            length = (int) demarshallint(buf, ofs[1], 4);            ofs[1] += 4;            rv = new ObjectPath(new String(buf, ofs[1], length), getSource());            ofs[1] += length + 1;            break;         case ArgumentType.SIGNATURE:            length = (buf[ofs[1]++] & 0xFF);            Vector<Type> types = new Vector<Type>();            Marshalling.getJavaType(new String(buf, ofs[1], (int)length), types, -1);            rv = types.toArray(new Type[0]);            ofs[1] += length + 1;            break;         default:             throw new UnknownTypeCodeException(sigb[ofs[0]]);      }      Debug.print(Debug.DEBUG, "Extracted: "+rv);      return rv;   }