本文整理了Java中com.esotericsoftware.kryo.io.Output.total()
方法的一些代码示例,展示了Output.total()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.total()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Output
类名称:Output
方法名:total
[英]Returns the total number of bytes written. This may include bytes that have not been flushed.
[中]返回写入的总字节数。这可能包括尚未刷新的字节。
代码示例来源:origin: org.gradle/gradle-messaging
/**
* Returns the total number of bytes written by this encoder, some of which may still be buffered.
*/
public int getWritePosition() {
return output.total();
}
代码示例来源:origin: com.twitter/chill-java
public int numOfWrittenBytes() { return (int)output.total(); }
public int numOfReadBytes() { return (int)input.total(); }
代码示例来源:origin: tv.cntt/chill-scala-2-11
public int numOfWrittenBytes() { return output.total(); }
public int numOfReadBytes() { return input.total(); }
代码示例来源:origin: org.apache.giraph/giraph-core
@Override
public long finalizeOutput() {
output.close();
long count = output.total();
return count;
}
}
代码示例来源:origin: usc-cloud/goffish
@Override
public long serialize(ISlice slice, OutputStream stream) throws IOException {
assert (slice != null);
if (!(stream instanceof Output)) {
// stream must be prepared with prepareStream
throw new IOException();
}
synchronized (stream) {
Output output = (Output)stream;
_kryo.get().writeObject(output, slice);
return output.total();
}
}
代码示例来源:origin: com.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 OutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos);
final String mimeType = serializeToString ? MIME_TYPE_STRINGD : MIME_TYPE;
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
final Map<String, Object> request = new HashMap<>();
request.put(SerTokens.TOKEN_REQUEST, requestMessage.getRequestId());
request.put(SerTokens.TOKEN_PROCESSOR, requestMessage.getProcessor());
request.put(SerTokens.TOKEN_OP, requestMessage.getOp());
request.put(SerTokens.TOKEN_ARGS, requestMessage.getArgs());
kryo.writeClassAndObject(output, request);
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
encodedMessage = allocator.buffer((int) size);
encodedMessage.writeBytes(output.toBytes());
}
return encodedMessage;
} catch (Exception ex) {
if (encodedMessage != null) ReferenceCountUtil.release(encodedMessage);
logger.warn("Request [{}] could not be serialized by {}.", requestMessage.toString(), KryoMessageSerializerV1d0.class.getName());
throw new SerializationException(ex);
}
}
代码示例来源:origin: com.tinkerpop/gremlin-driver
kryo.writeClassAndObject(output, message);
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
encodedMessage = allocator.buffer((int) output.total());
encodedMessage.writeBytes(output.toBytes());
内容来源于网络,如有侵权,请联系作者删除!