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


Java ObjectMap.get方法代码示例

本文整理汇总了Java中com.esotericsoftware.kryo.util.ObjectMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMap.get方法的具体用法?Java ObjectMap.get怎么用?Java ObjectMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esotericsoftware.kryo.util.ObjectMap的用法示例。


在下文中一共展示了ObjectMap.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
@Override
public Object read(Kryo kryo, Input input, Class type) {
    try {
        ObjectMap graphContext = kryo.getGraphContext();
        ObjectInputStream objectStream = (ObjectInputStream) graphContext.get(this);
        if (objectStream == null) {
            objectStream = new ObjectInputStream(input) {
                @Override
                protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
                    return ClassUtils.getClass(KryoSerialization.class.getClassLoader(), desc.getName());
                }
            };
            graphContext.put(this, objectStream);
        }
        return objectStream.readObject();
    } catch (Exception ex) {
        throw new KryoException("Error during Java deserialization.", ex);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:KryoSerialization.java

示例2: write

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void write(Kryo kryo, Output output, T o) {
	try {
		ObjectMap graphContext = kryo.getGraphContext();
		ObjectOutputStream objectStream = (ObjectOutputStream)graphContext.get(this);
		if (objectStream == null) {
			objectStream = new ObjectOutputStream(output);
			graphContext.put(this, objectStream);
		}
		objectStream.writeObject(o);
		objectStream.flush();
	} catch (Exception ex) {
		throw new KryoException("Error during Java serialization.", ex);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:JavaSerializer.java

示例3: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public T read(Kryo kryo, Input input, Class aClass) {
	try {
		ObjectMap graphContext = kryo.getGraphContext();
		ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this);
		if (objectStream == null) {
			// make sure we use Kryo's classloader
			objectStream = new InstantiationUtil.ClassLoaderObjectInputStream(input, kryo.getClassLoader());
			graphContext.put(this, objectStream);
		}
		return (T) objectStream.readObject();
	} catch (Exception ex) {
		throw new KryoException("Error during Java deserialization.", ex);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:JavaSerializer.java

示例4: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
@Override
public Object read(Kryo kryo, Input input, Class type)
{
  try {
    ObjectMap graphContext = kryo.getGraphContext();
    ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this);
    if (objectStream == null) {
      objectStream = new ObjectInputStreamWithKryoClassLoader(input, kryo);
      graphContext.put(this, objectStream);
    }
    return objectStream.readObject();
  } catch (Exception ex) {
    throw new KryoException("Error during Java deserialization.", ex);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:16,代码来源:KryoJavaSerializer.java

示例5: write

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, Object object) {
	try {
		ObjectMap graphContext = kryo.getGraphContext();
		ObjectOutputStream objectStream = (ObjectOutputStream)graphContext.get(this);
		if (objectStream == null) {
			objectStream = new ObjectOutputStream(output);
			graphContext.put(this, objectStream);
		}
		objectStream.writeObject(object);
		objectStream.flush();
	} catch (Exception ex) {
		throw new KryoException("Error during Java serialization.", ex);
	}
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:15,代码来源:JavaSerializer.java

示例6: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
public Object read (Kryo kryo, Input input, Class type) {
	try {
		ObjectMap graphContext = kryo.getGraphContext();
		ObjectInputStream objectStream = (ObjectInputStream)graphContext.get(this);
		if (objectStream == null) {
			objectStream = new ObjectInputStream(input);
			graphContext.put(this, objectStream);
		}
		return objectStream.readObject();
	} catch (Exception ex) {
		throw new KryoException("Error during Java deserialization.", ex);
	}
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:14,代码来源:JavaSerializer.java

示例7: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
public T read (Kryo kryo, Input input, Class<T> type) {
	T object = create(kryo, input, type);
	kryo.reference(object);
	ObjectMap context = kryo.getGraphContext();
	CachedField[] fields = (CachedField[])context.get(this);
	if (fields == null) {
		int length = input.readVarInt(true);
		if (TRACE) trace("kryo", "Read " + length + " field names.");
		String[] names = new String[length];
		for (int i = 0; i < length; i++)
			names[i] = input.readString();

		fields = new CachedField[length];
		CachedField[] allFields = getFields();
		outer:
		for (int i = 0, n = names.length; i < n; i++) {
			String schemaName = names[i];
			for (int ii = 0, nn = allFields.length; ii < nn; ii++) {
				if (allFields[ii].field.getName().equals(schemaName)) {
					fields[i] = allFields[ii];
					continue outer;
				}
			}
			if (TRACE) trace("kryo", "Ignore obsolete field: " + schemaName);
		}
		context.put(this, fields);
	}

	InputChunked inputChunked = new InputChunked(input, 1024);
	boolean hasGenerics = getGenerics() != null;
	for (int i = 0, n = fields.length; i < n; i++) {
		CachedField cachedField = fields[i];
		if(cachedField != null && hasGenerics) {
			// Generic type used to instantiate this field could have 
			// been changed in the meantime. Therefore take the most 
			// up-to-date definition of a field
			cachedField = getField(cachedField.field.getName());
		}
		if (cachedField == null) {
			if (TRACE) trace("kryo", "Skip obsolete field.");
			inputChunked.nextChunks();
			continue;
		}
		cachedField.read(inputChunked, object);
		inputChunked.nextChunks();
	}
	return object;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:49,代码来源:CompatibleFieldSerializer.java

示例8: read

import com.esotericsoftware.kryo.util.ObjectMap; //导入方法依赖的package包/类
public T read (Kryo kryo, Input input, Class<T> type) {
	T object = create(kryo, input, type);
	kryo.reference(object);
	ObjectMap context = kryo.getGraphContext();
	CachedField[] fields = (CachedField[])context.get(this);
	if (fields == null) {
		int length = input.readVarInt(true);
		if (TRACE) trace("kryo", "Read " + length + " field names.");
		String[] names = new String[length];
		for (int i = 0; i < length; i++)
			names[i] = input.readString();

		fields = new CachedField[length];
		CachedField[] allFields = getFields();
		outer:
		for (int i = 0, n = names.length; i < n; i++) {
			String schemaName = names[i];
			for (int ii = 0, nn = allFields.length; ii < nn; ii++) {
				if (allFields[ii].field.getName().equals(schemaName)) {
					fields[i] = allFields[ii];
					continue outer;
				}
			}
			if (TRACE) trace("kryo", "Ignore obsolete field: " + schemaName);
		}
		context.put(this, fields);
	}

	InputChunked inputChunked = new InputChunked(input, 1024);
	for (int i = 0, n = fields.length; i < n; i++) {
		CachedField cachedField = fields[i];
		if (cachedField == null) {
			if (TRACE) trace("kryo", "Skip obsolete field.");
			inputChunked.nextChunks();
			continue;
		}
		cachedField.read(inputChunked, object);
		inputChunked.nextChunks();
	}
	return object;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:42,代码来源:CompatibleFieldSerializer.java


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