本文整理汇总了Java中com.jme3.network.serializing.Serializer.readClassAndObject方法的典型用法代码示例。如果您正苦于以下问题:Java Serializer.readClassAndObject方法的具体用法?Java Serializer.readClassAndObject怎么用?Java Serializer.readClassAndObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.network.serializing.Serializer
的用法示例。
在下文中一共展示了Serializer.readClassAndObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readMethodCall
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
private RemoteMethodCallMessage readMethodCall(ByteBuffer buffer) throws IOException{
RemoteMethodCallMessage call = new RemoteMethodCallMessage();
call.objectId = buffer.getShort();
call.methodId = buffer.getShort();
call.invocationId = buffer.getShort();
int numArgs = buffer.get() & 0xff;
if (numArgs > 0){
Object[] args = new Object[numArgs];
for (int i = 0; i < numArgs; i++){
if (buffer.get() == (byte)0x01){
args[i] = Serializer.readClassAndObject(buffer);
}
}
call.args = args;
}
return call;
}
示例2: read
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
public void read(Object entity, ByteBuffer in, boolean init){
FieldTable table = getTable(entity.getClass());
for (SyncFieldInfo fieldInfo : table){
if ( (init && !fieldInfo.init)
|| (!init && !fieldInfo.sync) )
continue;
Field field = fieldInfo.field;
try {
Object obj = Serializer.readClassAndObject(in);
field.set(entity, obj);
} catch (Exception ex){
ex.printStackTrace();
}
}
}
示例3: convert
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
public void convert(String path) throws IOException {
byte[] bytes = Files.readAllBytes(Paths.get(path));
ByteBuffer buffer = ByteBuffer.wrap(bytes);
buffer.position(2);
ReplayData data = (ReplayData) Serializer.readClassAndObject(buffer);
ExtraMetadata extra = findExtraMetadata(data);
Path outputPath = Paths.get("converted",
Paths.get(path).getFileName().toString());
ByteBuffer outBuffer = ByteBuffer.allocate(314572800); // 300 MB
// serializer.convertFromOld(outBuffer, data, extra);
outBuffer.flip();
Path filePath = Files.createFile(outputPath);
writeToFile(outBuffer, filePath);
}
示例4: createMessage
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
/**
* Creates a message from the properly sized byte buffer
* and adds it to the messages queue.
*/
protected void createMessage( ByteBuffer buffer )
{
try {
Object obj = Serializer.readClassAndObject( buffer );
Message m = (Message)obj;
messages.add(m);
} catch( IOException e ) {
throw new RuntimeException( "Error deserializing object", e );
}
}
示例5: readMethodReturn
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
private RemoteMethodReturnMessage readMethodReturn(ByteBuffer buffer) throws IOException{
RemoteMethodReturnMessage ret = new RemoteMethodReturnMessage();
ret.invocationID = buffer.getShort();
if (buffer.get() == (byte)0x01){
ret.retVal = Serializer.readClassAndObject(buffer);
}
return ret;
}
示例6: readObject
import com.jme3.network.serializing.Serializer; //导入方法依赖的package包/类
@Override
public UserData readObject(ByteBuffer data, Class c) throws IOException {
byte type = data.get();
Object value = Serializer.readClassAndObject(data);
return new UserData(type, value);
}