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


Java ObjectDataOutput.toByteArray方法代码示例

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


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

示例1: createFlowControlPacket

import com.hazelcast.nio.ObjectDataOutput; //导入方法依赖的package包/类
private byte[] createFlowControlPacket(Address member) throws IOException {
    final ObjectDataOutput out = createObjectDataOutput(nodeEngine);
    final boolean[] hasData = {false};
    Map<Long, ExecutionContext> executionContexts = jobExecutionService.getExecutionContexts();
    out.writeInt(executionContexts.size());
    executionContexts.forEach((execId, exeCtx) -> uncheckRun(() -> {
        if (!exeCtx.hasParticipant(member)) {
            return;
        }
        out.writeLong(execId);
        out.writeInt(exeCtx.receiverMap().values().stream().mapToInt(Map::size).sum());
        exeCtx.receiverMap().forEach((vertexId, ordinalToSenderToTasklet) ->
                ordinalToSenderToTasklet.forEach((ordinal, senderToTasklet) -> uncheckRun(() -> {
                    out.writeInt(vertexId);
                    out.writeInt(ordinal);
                    out.writeInt(senderToTasklet.get(member).updateAndGetSendSeqLimitCompressed());
                    hasData[0] = true;
                })));
    }));
    return hasData[0] ? out.toByteArray() : EMPTY_BYTES;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:22,代码来源:Networking.java

示例2: createStreamPacketHeader

import com.hazelcast.nio.ObjectDataOutput; //导入方法依赖的package包/类
public static byte[] createStreamPacketHeader(NodeEngine nodeEngine, long executionId,
                                              int destinationVertexId, int ordinal) {
    ObjectDataOutput out = createObjectDataOutput(nodeEngine);
    try {
        out.writeLong(executionId);
        out.writeInt(destinationVertexId);
        out.writeInt(ordinal);
        return out.toByteArray();
    } catch (IOException e) {
        throw sneakyThrow(e);
    }
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:13,代码来源:Networking.java

示例3: convertToJson

import com.hazelcast.nio.ObjectDataOutput; //导入方法依赖的package包/类
private <T extends Serializable> JsonElement convertToJson(DolphinEvent<T> event) throws IOException {
    final EventStreamSerializer streamSerializer = new EventStreamSerializer();
    final ObjectDataOutput output = new ByteObjectDataOutput();
    streamSerializer.write(output, event);
    final byte[] rawOutputData = output.toByteArray();
    final String outputData = new String(rawOutputData);
    return new JsonParser().parse(outputData);
}
 
开发者ID:canoo,项目名称:dolphin-platform,代码行数:9,代码来源:EventStreamSerializerTests.java

示例4: writeData

import com.hazelcast.nio.ObjectDataOutput; //导入方法依赖的package包/类
@Override
public void writeData(ObjectDataOutput out) throws IOException {
	InternalSerializationService ss = getSerializationService();
	ObjectDataOutput tmp = ss.createObjectDataOutput();
	super.writeData(tmp);
	byte[] data = tmp.toByteArray();
	byte[] data2 = IOUtil.compress(data);
	//logger.info("writeData; original size: {}; compressed size: {}", data.length, data2.length);
	out.writeByteArray(data2);
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:11,代码来源:CompressingCursorImpl.java


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