Java Code Examples for com.caucho.hessian.io.AbstractHessianInput#readString()

The following examples show how to use com.caucho.hessian.io.AbstractHessianInput#readString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenericClassDeserializer.java    From sofa-hessian with Apache License 2.0 6 votes vote down vote up
/**
 * 当读取Object时会调用此方法, Object类型包括Enum与AliEnum
 */
public Object readObject(AbstractHessianInput in, Object[] fieldNames) throws IOException {
    int ref = in.addRef(null);

    String name = null;

    for (int i = 0; i < fieldNames.length; i++) {
        if ("name".equals(fieldNames[i])) {
            name = in.readString();
        } else {
            in.readObject();
        }
    }

    Object value;
    if (ClassFilter.filter(name)) {
        value = create(name);
    } else {
        value = new GenericClass(name);
    }

    in.setRef(ref, value);

    return value;
}
 
Example 2
Source File: TranscribableEnumDeserializer.java    From cougar with Apache License 2.0 6 votes vote down vote up
public Object readMap(AbstractHessianInput in) throws IOException {
    String name = null;

    while (!in.isEnd()) {
        String key = in.readString();

        if (key.equals("name")) {
            name = in.readString();
        }
        else {
            in.readObject();
        }
    }

    in.readMapEnd();

    Object obj = transcriptionParams.contains(TranscribableParams.EnumsWrittenAsStrings) ? name : create(name);

    in.addRef(obj);

    return obj;
}
 
Example 3
Source File: TranscribableEnumDeserializer.java    From cougar with Apache License 2.0 6 votes vote down vote up
@Override
public Object readObject(AbstractHessianInput in, Object[] fields) throws IOException {
    String[] fieldNames = (String[]) fields;
    String name = null;

    for (int i = 0; i < fieldNames.length; i++) {
        if ("name".equals(fieldNames[i])) {
            name = in.readString();
        }
        else {
            in.readObject();
        }
    }

    Object obj = create(name);

    in.addRef(obj);

    return obj;
}
 
Example 4
Source File: MBeanNotificationInfoDeserializer.java    From sofa-hessian with Apache License 2.0 5 votes vote down vote up
public Object readMap(AbstractHessianInput in)
    throws IOException
{
    String name = null;
    String description = null;
    String[] types = null;

    while (!in.isEnd()) {
        String key = in.readString();

        if ("name".equals(key))
            name = in.readString();
        else if ("description".equals(key))
            description = in.readString();
        else if ("types".equals(key))
            types = (String[]) in.readObject(String[].class);
        else {
            in.readObject();
        }
    }

    in.readMapEnd();

    try {
        MBeanNotificationInfo info;

        info = new MBeanNotificationInfo(types, name, description);

        return info;
    } catch (Exception e) {
        throw new IOException(String.valueOf(e));
    }
}
 
Example 5
Source File: MyListDeserializer.java    From sofa-hessian with Apache License 2.0 5 votes vote down vote up
void deserialize(AbstractHessianInput in, Object obj) throws IOException {
    String value = null;

    try {
        value = in.readString();

        _field.set(obj, value);
    } catch (Exception e) {
        logDeserializeError(_field, obj, value, e);
    }
}
 
Example 6
Source File: MBeanInfoDeserializer.java    From jvm-sandbox-repeater with Apache License 2.0 4 votes vote down vote up
public Object readMap(AbstractHessianInput in)
  throws IOException
{
  String className = null;
  String description = null;
  MBeanAttributeInfo []attributes = null;
  MBeanConstructorInfo []constructors = null;
  MBeanOperationInfo []operations = null;
  MBeanNotificationInfo []notifications = null;
  
  while (! in.isEnd()) {
    String key = in.readString();

    if ("className".equals(key))
      className = in.readString();
    else if ("description".equals(key))
      description = in.readString();
    else if ("attributes".equals(key)) {
      attributes = (MBeanAttributeInfo []) in.readObject(MBeanAttributeInfo[].class);
    }
    /*
    else if ("isWrite".equals(key))
      isWrite = in.readBoolean();
    else if ("isIs".equals(key))
      isIs = in.readBoolean();
    */
    else
      in.readObject();
  }

  in.readMapEnd();

  try {
    MBeanInfo info;
    
    info = new MBeanInfo(className, description, attributes,
                         constructors, operations, notifications);

    return info;
  } catch (Exception e) {
    throw new IOException(String.valueOf(e));
  }
}
 
Example 7
Source File: TranscribableEnumDeserializer.java    From cougar with Apache License 2.0 4 votes vote down vote up
public Object readObject(AbstractHessianInput in) throws IOException {
    return in.readString();
}