当前位置: 首页>>代码示例>>Java>>正文


Java Serializer.readClassAndObject方法代码示例

本文整理汇总了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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:RmiSerializer.java

示例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();
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:SyncSerializer.java

示例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);
    }
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:19,代码来源:ReplayConverter.java

示例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 );   
    }         
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:MessageProtocol.java

示例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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:RmiSerializer.java

示例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);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:7,代码来源:UserDataSerializer.java


注:本文中的com.jme3.network.serializing.Serializer.readClassAndObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。