本文整理汇总了Java中com.google.common.hash.PrimitiveSink类的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveSink类的具体用法?Java PrimitiveSink怎么用?Java PrimitiveSink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveSink类属于com.google.common.hash包,在下文中一共展示了PrimitiveSink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readBloomFilterFromfile
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
static BloomFilter<String> readBloomFilterFromfile(String bloomFilterFilePath) throws IOException {
Funnel<String> memberFunnel = new Funnel<String>() {
public void funnel(String memberId, PrimitiveSink sink) {
sink.putString(memberId, Charsets.UTF_8);
}
};
try
{
FileInputStream fis = new FileInputStream(new File(bloomFilterFilePath));
return BloomFilter.readFrom(fis, memberFunnel);
}
catch(Exception e)
{
e.printStackTrace();
}
return null;
}
示例2: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(StatisticParameters o, PrimitiveSink into)
{
into
.putUnencodedChars(o.getClass().getCanonicalName())
.putChar(':')
.putUnencodedChars(Strings.nullToEmpty(o.lang))
.putFloat(o.quantile)
.putInt(o.duration)
.putUnencodedChars(Strings.nullToEmpty(o.type))
.putInt(o.maxDevices)
.putUnencodedChars(Strings.nullToEmpty(o.networkTypeGroup))
.putDouble(o.accuracy)
.putUnencodedChars(Strings.nullToEmpty(o.country))
.putBoolean(o.userServerSelection)
.putInt((endDate == null) ? 0 : (int) endDate.getTime())
.putInt(o.province);
}
示例3: ensureGeneric
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Test
public void ensureGeneric() {
class SuperClass {
}
class SubClass extends SuperClass {
}
CuckooFilter<SuperClass> filter = CuckooFilter.create(
new Funnel<SuperClass>() {
public void funnel(SuperClass from, PrimitiveSink into) {
into.putInt(from.hashCode());
}
}, 1000, 0.03D);
assertTrue(filter.add(new SuperClass()));
assertTrue(filter.add(new SubClass()));
}
示例4: GrowthTracker
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
GrowthTracker(
final SerializableFunction<OutputT, KeyT> keyFn,
final Coder<KeyT> outputKeyCoder,
GrowthState<OutputT, KeyT, TerminationStateT> state,
Growth.TerminationCondition<?, TerminationStateT> terminationCondition) {
this.coderFunnel =
new Funnel<OutputT>() {
@Override
public void funnel(OutputT from, PrimitiveSink into) {
try {
// Rather than hashing the output itself, hash the output key.
KeyT outputKey = keyFn.apply(from);
outputKeyCoder.encode(outputKey, Funnels.asOutputStream(into));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
};
this.terminationCondition = terminationCondition;
this.state = state;
this.isOutputComplete = state.isOutputComplete;
this.pollWatermark = state.pollWatermark;
this.terminationState = state.terminationState;
this.pending = Lists.newLinkedList(state.pending);
}
示例5: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFFlowRemovedVer14 message, PrimitiveSink sink) {
// fixed value property version = 5
sink.putByte((byte) 0x5);
// fixed value property type = 11
sink.putByte((byte) 0xb);
// FIXME: skip funnel of length
sink.putLong(message.xid);
message.cookie.putTo(sink);
sink.putInt(message.priority);
sink.putShort(message.reason);
message.tableId.putTo(sink);
sink.putLong(message.durationSec);
sink.putLong(message.durationNsec);
sink.putInt(message.idleTimeout);
sink.putInt(message.hardTimeout);
message.packetCount.putTo(sink);
message.byteCount.putTo(sink);
message.match.putTo(sink);
}
示例6: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFPortModVer12 message, PrimitiveSink sink) {
// fixed value property version = 3
sink.putByte((byte) 0x3);
// fixed value property type = 16
sink.putByte((byte) 0x10);
// fixed value property length = 40
sink.putShort((short) 0x28);
sink.putLong(message.xid);
message.portNo.putTo(sink);
// skip pad (4 bytes)
message.hwAddr.putTo(sink);
// skip pad (2 bytes)
sink.putLong(message.config);
sink.putLong(message.mask);
sink.putLong(message.advertise);
// skip pad (4 bytes)
}
示例7: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnGentableEntryStatsReplyVer14 message, PrimitiveSink sink) {
// fixed value property version = 5
sink.putByte((byte) 0x5);
// fixed value property type = 19
sink.putByte((byte) 0x13);
// FIXME: skip funnel of length
sink.putLong(message.xid);
// fixed value property statsType = 65535
sink.putShort((short) 0xffff);
OFStatsReplyFlagsSerializerVer14.putTo(message.flags, sink);
// skip pad (4 bytes)
// fixed value property experimenter = 0x5c16c7L
sink.putInt(0x5c16c7);
// fixed value property subtype = 0x3L
sink.putInt(0x3);
FunnelUtils.putList(message.entries, sink);
}
示例8: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnGetMirroringReplyVer11 message, PrimitiveSink sink) {
// fixed value property version = 2
sink.putByte((byte) 0x2);
// fixed value property type = 4
sink.putByte((byte) 0x4);
// fixed value property length = 20
sink.putShort((short) 0x14);
sink.putLong(message.xid);
// fixed value property experimenter = 0x5c16c7L
sink.putInt(0x5c16c7);
// fixed value property subtype = 0x5L
sink.putInt(0x5);
sink.putShort(message.reportMirrorPorts);
// skip pad (3 bytes)
}
示例9: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFFeaturesReplyVer14 message, PrimitiveSink sink) {
// fixed value property version = 5
sink.putByte((byte) 0x5);
// fixed value property type = 6
sink.putByte((byte) 0x6);
// fixed value property length = 32
sink.putShort((short) 0x20);
sink.putLong(message.xid);
message.datapathId.putTo(sink);
sink.putLong(message.nBuffers);
sink.putShort(message.nTables);
message.auxiliaryId.putTo(sink);
// skip pad (2 bytes)
OFCapabilitiesSerializerVer14.putTo(message.capabilities, sink);
sink.putLong(message.reserved);
}
示例10: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnBwEnableSetReplyVer12 message, PrimitiveSink sink) {
// fixed value property version = 3
sink.putByte((byte) 0x3);
// fixed value property type = 4
sink.putByte((byte) 0x4);
// fixed value property length = 24
sink.putShort((short) 0x18);
sink.putLong(message.xid);
// fixed value property experimenter = 0x5c16c7L
sink.putInt(0x5c16c7);
// fixed value property subtype = 0x17L
sink.putInt(0x17);
sink.putLong(message.enable);
sink.putLong(message.status);
}
示例11: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFFlowRemovedVer13 message, PrimitiveSink sink) {
// fixed value property version = 4
sink.putByte((byte) 0x4);
// fixed value property type = 11
sink.putByte((byte) 0xb);
// FIXME: skip funnel of length
sink.putLong(message.xid);
message.cookie.putTo(sink);
sink.putInt(message.priority);
sink.putShort(message.reason);
message.tableId.putTo(sink);
sink.putLong(message.durationSec);
sink.putLong(message.durationNsec);
sink.putInt(message.idleTimeout);
sink.putInt(message.hardTimeout);
message.packetCount.putTo(sink);
message.byteCount.putTo(sink);
message.match.putTo(sink);
}
示例12: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnVirtualPortCreateReplyVer12 message, PrimitiveSink sink) {
// fixed value property version = 3
sink.putByte((byte) 0x3);
// fixed value property type = 4
sink.putByte((byte) 0x4);
// fixed value property length = 24
sink.putShort((short) 0x18);
sink.putLong(message.xid);
// fixed value property experimenter = 0x5c16c7L
sink.putInt(0x5c16c7);
// fixed value property subtype = 0x10L
sink.putInt(0x10);
sink.putLong(message.status);
sink.putLong(message.vportNo);
}
示例13: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnGetMirroringReplyVer10 message, PrimitiveSink sink) {
// fixed value property version = 1
sink.putByte((byte) 0x1);
// fixed value property type = 4
sink.putByte((byte) 0x4);
// fixed value property length = 20
sink.putShort((short) 0x14);
sink.putLong(message.xid);
// fixed value property experimenter = 0x5c16c7L
sink.putInt(0x5c16c7);
// fixed value property subtype = 0x5L
sink.putInt(0x5);
sink.putShort(message.reportMirrorPorts);
// skip pad (3 bytes)
}
示例14: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFBsnLacpStatsEntryVer13 message, PrimitiveSink sink) {
message.portNo.putTo(sink);
sink.putInt(message.actorSysPriority);
message.actorSysMac.putTo(sink);
sink.putInt(message.actorPortPriority);
sink.putInt(message.actorPortNum);
sink.putInt(message.actorKey);
sink.putShort(message.convergenceStatus);
// skip pad (1 bytes)
sink.putInt(message.partnerSysPriority);
message.partnerSysMac.putTo(sink);
sink.putInt(message.partnerPortPriority);
sink.putInt(message.partnerPortNum);
sink.putInt(message.partnerKey);
// skip pad (2 bytes)
}
示例15: funnel
import com.google.common.hash.PrimitiveSink; //导入依赖的package包/类
@Override
public void funnel(OFAggregateStatsReplyVer13 message, PrimitiveSink sink) {
// fixed value property version = 4
sink.putByte((byte) 0x4);
// fixed value property type = 19
sink.putByte((byte) 0x13);
// fixed value property length = 40
sink.putShort((short) 0x28);
sink.putLong(message.xid);
// fixed value property statsType = 2
sink.putShort((short) 0x2);
OFStatsReplyFlagsSerializerVer13.putTo(message.flags, sink);
// skip pad (4 bytes)
message.packetCount.putTo(sink);
message.byteCount.putTo(sink);
sink.putLong(message.flowCount);
// skip pad (4 bytes)
}