本文整理了Java中com.esotericsoftware.kryo.Kryo.getContext()
方法的一些代码示例,展示了Kryo.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.getContext()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:getContext
[英]Name/value pairs that are available to all serializers.
[中]可用于所有序列化程序的名称/值对。
代码示例来源:origin: EsotericSoftware/kryonet
public synchronized Object read (Connection connection, ByteBuffer buffer) {
input.setBuffer(buffer);
kryo.getContext().put("connection", connection);
return kryo.readClassAndObject(input);
}
代码示例来源:origin: EsotericSoftware/kryonet
public Object read (Kryo kryo, Input input, Class type) {
int objectID = input.readInt(true);
Connection connection = (Connection)kryo.getContext().get("connection");
return ObjectSpace.getRemoteObject(connection, objectID, type);
}
}
代码示例来源:origin: EsotericSoftware/kryonet
public Object read (Kryo kryo, Input input, Class type) {
int objectID = input.readInt(true);
Connection connection = (Connection)kryo.getContext().get("connection");
Object object = getRegisteredObject(connection, objectID);
if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection);
return object;
}
});
代码示例来源:origin: EsotericSoftware/kryonet
public void write (Kryo kryo, Output output, Object object) {
Connection connection = (Connection)kryo.getContext().get("connection");
int id = getRegisteredID(connection, object);
if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object);
output.writeInt(id, true);
}
代码示例来源:origin: EsotericSoftware/kryonet
public synchronized void write (Connection connection, ByteBuffer buffer, Object object) {
output.setBuffer(buffer);
kryo.getContext().put("connection", connection);
kryo.writeClassAndObject(output, object);
output.flush();
}
代码示例来源:origin: inspectIT/inspectIT
/**
*
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public Object read(Connection connection, InputStream inputStream) {
Input input = new Input(inputStream);
IKryoProvider kryoProvider = serializerQueue.poll();
// if nothing is available in queue don't wait, create new one
if (null == kryoProvider) {
kryoProvider = createKryoProvider();
}
try {
Kryo kryo = kryoProvider.getKryo();
kryo.getContext().put("connection", connection);
return kryo.readClassAndObject(input);
} finally {
serializerQueue.offer(kryoProvider);
}
}
代码示例来源:origin: com.esotericsoftware/kryonet
public Object read (Kryo kryo, Input input, Class type) {
int objectID = input.readInt(true);
Connection connection = (Connection)kryo.getContext().get("connection");
return ObjectSpace.getRemoteObject(connection, objectID, type);
}
}
代码示例来源:origin: com.esotericsoftware/kryonet
public synchronized Object read (Connection connection, ByteBuffer buffer) {
input.setBuffer(buffer);
kryo.getContext().put("connection", connection);
return kryo.readClassAndObject(input);
}
代码示例来源:origin: inspectIT/inspectIT
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public void write(Connection connection, OutputStream outputStream, Object object) {
Output output = new Output(outputStream);
IKryoProvider kryoProvider = serializerQueue.poll();
// if nothing is available in queue don't wait, create new one
if (null == kryoProvider) {
kryoProvider = createKryoProvider();
}
try {
Kryo kryo = kryoProvider.getKryo();
kryo.getContext().put("connection", connection);
kryo.writeClassAndObject(output, object);
output.flush();
} finally {
serializerQueue.offer(kryoProvider);
}
}
代码示例来源:origin: com.esotericsoftware/kryonet
public void write (Kryo kryo, Output output, Object object) {
Connection connection = (Connection)kryo.getContext().get("connection");
int id = getRegisteredID(connection, object);
if (id == Integer.MAX_VALUE) throw new KryoNetException("Object not found in an ObjectSpace: " + object);
output.writeInt(id, true);
}
代码示例来源:origin: com.esotericsoftware/kryonet
public synchronized void write (Connection connection, ByteBuffer buffer, Object object) {
output.setBuffer(buffer);
kryo.getContext().put("connection", connection);
kryo.writeClassAndObject(output, object);
output.flush();
}
代码示例来源:origin: inspectIT/inspectIT
@Override
public Object read(Kryo kryo, Input input, Class type) {
int objectID = input.readInt(true);
Connection connection = (Connection) kryo.getContext().get("connection");
Object object = getRegisteredObject(connection, objectID);
if (WARN && (object == null)) {
warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection);
}
return object;
}
}, nextRegistrationId++);
代码示例来源:origin: com.esotericsoftware/kryonet
public Object read (Kryo kryo, Input input, Class type) {
int objectID = input.readInt(true);
Connection connection = (Connection)kryo.getContext().get("connection");
Object object = getRegisteredObject(connection, objectID);
if (WARN && object == null) warn("kryonet", "Unknown object ID " + objectID + " for connection: " + connection);
return object;
}
});
代码示例来源:origin: svn2github/kryo
ObjectMap context = kryo.getContext();
代码示例来源:origin: com.esotericsoftware.kryo/kryo
ObjectMap context = kryo.getContext();
代码示例来源:origin: com.esotericsoftware/kryo
ObjectMap context = kryo.getContext();
代码示例来源:origin: com.esotericsoftware/kryo-shaded
ObjectMap context = kryo.getContext();
内容来源于网络,如有侵权,请联系作者删除!