本文整理汇总了Java中org.nustaq.serialization.FSTObjectInput.read方法的典型用法代码示例。如果您正苦于以下问题:Java FSTObjectInput.read方法的具体用法?Java FSTObjectInput.read怎么用?Java FSTObjectInput.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nustaq.serialization.FSTObjectInput
的用法示例。
在下文中一共展示了FSTObjectInput.read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiate
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee,
int streamPosition) throws Exception {
int len = in.readInt();
byte[] buf = new byte[len];
in.read(buf);
BigInteger bigInteger = new BigInteger(buf);
in.registerObject(bigInteger,streamPosition,serializationInfo,referencee);
return bigInteger;
}
示例2: instantiate
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTClazzInfo.FSTFieldInfo referencee, int streamPosition) throws Exception {
int len = in.readFInt();
byte bytes[] = new byte[len];
if ( COMPRESS ) {
int intsiz = len/4;
int count = 0;
for ( int n=0; n<intsiz;n++ ) {
int value = 0;
int i = 0;
int b;
while (((b = in.readByte()) & 0x80) != 0) {
value |= (b & 0x7F) << i;
i += 7;
}
value = value | (b << i);
int temp = (((value << 31) >> 31) ^ value) >> 1;
value = temp ^ (value & (1 << 31));
bytes[count++] = (byte) ((value >>> 0) & 0xFF);
bytes[count++] = (byte) ((value >>> 8) & 0xFF);
bytes[count++] = (byte) ((value >>> 16) & 0xFF);
bytes[count++] = (byte) ((value >>> 24) & 0xFF);
}
int remainder = len&3;
for ( int i = 0; i < remainder; i++) {
bytes[count++] = in.readByte();
}
} else {
in.read(bytes);
}
HeapBytez hb = new HeapBytez(bytes);
return FSTStructFactory.getInstance().createStructWrapper(hb, 0);
}
示例3: instantiate
import org.nustaq.serialization.FSTObjectInput; //导入方法依赖的package包/类
@Override
public Object instantiate(Class objectClass, FSTObjectInput in, FSTClazzInfo serializationInfo, FSTFieldInfo referencee,
int streamPosition) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
byte[] buf = new byte[in.readInt()];
in.read(buf);
PeerAddress address = new PeerAddress(buf);
in.registerObject(address, streamPosition, serializationInfo, referencee);
return address;
}