本文整理了Java中org.apache.tinkerpop.shaded.kryo.io.Output.writeByte()
方法的一些代码示例,展示了Output.writeByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.writeByte()
方法的具体详情如下:
包路径:org.apache.tinkerpop.shaded.kryo.io.Output
类名称:Output
方法名:writeByte
暂无
代码示例来源:origin: JanusGraph/janusgraph
@Override
public void write(Kryo kryo, Output output, P p) {
output.writeString(
p instanceof ConnectiveP ? (p instanceof AndP ? "and" : "or") : p.getBiPredicate().toString());
if (p instanceof ConnectiveP || p.getValue() instanceof Collection) {
output.writeByte((byte) 0);
final Collection<?> coll = p instanceof ConnectiveP ? ((ConnectiveP<?>) p).getPredicates()
: (Collection) p.getValue();
output.writeInt(coll.size());
coll.forEach(v -> kryo.writeClassAndObject(output, v));
} else {
output.writeByte((byte) 1);
kryo.writeClassAndObject(output, p.getValue());
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public void writeByte(final byte b) {
shadedOutput.writeByte(b);
}
代码示例来源:origin: apache/tinkerpop
@Override
public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
ByteBuf encodedMessage = null;
try {
final Kryo kryo = kryoThreadLocal.get();
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos, bufferSize);
final String mimeType = mimeTypesSupported()[0];
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
kryo.writeObject(output, requestMessage);
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
output.flush();
encodedMessage = allocator.buffer((int) size);
encodedMessage.writeBytes(baos.toByteArray());
}
return encodedMessage;
} catch (Exception ex) {
if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
logger.warn(String.format("Request [%s] could not be serialized by %s.", requestMessage, AbstractGryoMessageSerializerV3d0.class.getName()), ex);
throw new SerializationException(ex);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
ByteBuf encodedMessage = null;
try {
final Kryo kryo = kryoThreadLocal.get();
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos, bufferSize);
final String mimeType = mimeTypesSupported()[0];
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
kryo.writeObject(output, requestMessage.getRequestId());
output.writeString(requestMessage.getProcessor());
output.writeString(requestMessage.getOp());
kryo.writeObject(output, requestMessage.getArgs());
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
output.flush();
encodedMessage = allocator.buffer((int) size);
encodedMessage.writeBytes(baos.toByteArray());
}
return encodedMessage;
} catch (Exception ex) {
if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
logger.warn(String.format("Request [%s] could not be serialized by %s.", requestMessage, AbstractGryoMessageSerializerV1d0.class.getName()), ex);
throw new SerializationException(ex);
}
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public void writeByte(final byte b) {
shadedOutput.writeByte(b);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-driver
@Override
public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
ByteBuf encodedMessage = null;
try {
final Kryo kryo = kryoThreadLocal.get();
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos, bufferSize);
final String mimeType = mimeTypesSupported()[0];
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
kryo.writeObject(output, requestMessage);
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
output.flush();
encodedMessage = allocator.buffer((int) size);
encodedMessage.writeBytes(baos.toByteArray());
}
return encodedMessage;
} catch (Exception ex) {
if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
logger.warn(String.format("Request [%s] could not be serialized by %s.", requestMessage, AbstractGryoMessageSerializerV3d0.class.getName()), ex);
throw new SerializationException(ex);
}
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-driver
@Override
public ByteBuf serializeRequestAsBinary(final RequestMessage requestMessage, final ByteBufAllocator allocator) throws SerializationException {
ByteBuf encodedMessage = null;
try {
final Kryo kryo = kryoThreadLocal.get();
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos, bufferSize);
final String mimeType = mimeTypesSupported()[0];
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
kryo.writeObject(output, requestMessage.getRequestId());
output.writeString(requestMessage.getProcessor());
output.writeString(requestMessage.getOp());
kryo.writeObject(output, requestMessage.getArgs());
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
output.flush();
encodedMessage = allocator.buffer((int) size);
encodedMessage.writeBytes(baos.toByteArray());
}
return encodedMessage;
} catch (Exception ex) {
if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
logger.warn(String.format("Request [%s] could not be serialized by %s.", requestMessage, AbstractGryoMessageSerializerV1d0.class.getName()), ex);
throw new SerializationException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!