com.clickntap.tool.hessian.BigIntegerDeSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Stripecube Show documentation
Show all versions of Stripecube Show documentation
Stripecube is an open source Java framework for Web Applications
package com.clickntap.tool.hessian;
import com.caucho.hessian.io.AbstractDeserializer;
import com.caucho.hessian.io.AbstractHessianInput;
import java.io.IOException;
import java.math.BigInteger;
public class BigIntegerDeSerializer extends AbstractDeserializer {
public Class getType() {
return BigInteger.class;
}
public Object readMap(AbstractHessianInput in) throws IOException {
int ref = in.addRef(null);
String initValue = null;
while (!in.isEnd()) {
String key = in.readString();
if (key.equals("value"))
initValue = in.readString();
else
in.readString();
}
in.readMapEnd();
Object value = new BigInteger(initValue);
in.setRef(ref, value);
return value;
}
public Object readObject(AbstractHessianInput in, String[] fieldNames) throws IOException {
int ref = in.addRef(null);
String initValue = null;
for (String key : fieldNames) {
if (key.equals("value"))
initValue = in.readString();
else
in.readObject();
}
Object value = new BigInteger(initValue);
in.setRef(ref, value);
return value;
}
}