Exemplo n.º 1
0
 public String readString() throws IOException {
   final ObjectInput in = this.in;
   final int cn = in.readInt();
   if (cn >= 0) {
     if (cn == 0) {
       return "";
     } else if (cn <= 64) {
       for (int ci = 0; ci < cn; ci++) {
         this.ca[ci] = in.readChar();
       }
       return new String(this.ca, 0, cn);
     } else if (cn <= CB_LENGTH) {
       final int bn = cn << 1;
       in.readFully(this.ba, 0, bn);
       if (!this.bb.hasArray()) {
         this.bb.clear();
         this.bb.put(this.ba, 0, bn);
       }
       this.cb.clear();
       this.cb.get(this.ca, 0, cn);
       return new String(this.ca, 0, cn);
     } else if (cn <= CA_LENGTH) {
       return readString(cn, this.ca, in);
     } else {
       return readString(cn, new char[cn], in);
     }
   } else if (cn != Integer.MIN_VALUE) {
     in.readFully(this.ba, 0, -cn);
     return new String(this.ba, 0, 0, -cn);
   } else {
     return null;
   }
 }
Exemplo n.º 2
0
 @Override
 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
   super.readExternal(in);
   final GeneralPathRegionOfInterest roi = getRegionOfInterest();
   roi.reset();
   for (; ; ) {
     char type = in.readChar();
     switch (type) {
       case 'M':
         roi.moveTo(in.readDouble(), in.readDouble());
         break;
       case 'L':
         roi.lineTo(in.readDouble(), in.readDouble());
         break;
       case 'Q':
         roi.quadTo(in.readDouble(), in.readDouble(), in.readDouble(), in.readDouble());
         break;
       case 'C':
         roi.cubicTo(
             in.readDouble(),
             in.readDouble(),
             in.readDouble(),
             in.readDouble(),
             in.readDouble(),
             in.readDouble());
         break;
       case ')':
         roi.close();
         break;
       case '.':
         break;
     }
   }
 }
 static void readSlotWithFields(
     short fieldsKey[], ClassMetaDataSlot slot, ObjectInput input, Object obj)
     throws IOException, ClassNotFoundException {
   short numberOfFields = (short) fieldsKey.length;
   for (short i = 0; i < numberOfFields; i++) {
     ClassMetadataField field = slot.getFields()[fieldsKey[i]];
     if (field.getField().getType() == Integer.TYPE) {
       FieldsManager.getFieldsManager().setInt(obj, field, input.readInt());
     } else if (field.getField().getType() == Byte.TYPE) {
       FieldsManager.getFieldsManager().setByte(obj, field, input.readByte());
     } else if (field.getField().getType() == Long.TYPE) {
       FieldsManager.getFieldsManager().setLong(obj, field, input.readLong());
     } else if (field.getField().getType() == Float.TYPE) {
       FieldsManager.getFieldsManager().setFloat(obj, field, input.readFloat());
     } else if (field.getField().getType() == Double.TYPE) {
       FieldsManager.getFieldsManager().setDouble(obj, field, input.readDouble());
     } else if (field.getField().getType() == Short.TYPE) {
       FieldsManager.getFieldsManager().setShort(obj, field, input.readShort());
     } else if (field.getField().getType() == Character.TYPE) {
       FieldsManager.getFieldsManager().setCharacter(obj, field, input.readChar());
     } else if (field.getField().getType() == Boolean.TYPE) {
       FieldsManager.getFieldsManager().setBoolean(obj, field, input.readBoolean());
     } else {
       Object objTmp = input.readObject();
       FieldsManager.getFieldsManager().setObject(obj, field, objTmp);
     }
   }
 }
Exemplo n.º 4
0
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    in.readByte();

    super.readExternal(in);

    int size = in.readInt();
    setUp(size);
    while (size-- > 0) {
      char key = in.readChar();
      short val = in.readShort();
      put(key, val);
    }
  }
Exemplo n.º 5
0
  /** {@inheritDoc} */
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    // VERSION
    in.readByte();

    // SUPER
    super.readExternal(in);

    // NUMBER OF ENTRIES
    int size = in.readInt();
    setUp(size);

    // ENTRIES
    while (size-- > 0) {
      double key = in.readDouble();
      char val = in.readChar();
      put(key, val);
    }
  }
Exemplo n.º 6
0
 @Override
 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
   char[] tmp = new char[in.readInt()];
   for (int i = 0; i < tmp.length; i++) {
     tmp[i] = in.readChar();
   }
   String typeName = new String(tmp);
   if (typeName.equals("int")) {
     type = int.class;
   } else if (typeName.equals("long")) {
     type = long.class;
   } else if (typeName.equals("float")) {
     type = float.class;
   } else if (typeName.equals("double")) {
     type = double.class;
   } else {
     assert !typeName.contains(".") : "Not supported type:" + typeName;
     type = Class.forName(typeName);
   }
   arg = in.readObject();
 }
 @Override
 protected Object readObject(ObjectInput in) throws IOException {
   return Character.valueOf(in.readChar());
 }