Java 类com.google.common.hash.PrimitiveSink 实例源码

项目:echo    文件:EdgentFilter_RBI.java   
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;
}
项目:echo    文件:EdgentFilter_RBI.java   
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;
}
项目:open-rmbt    文件:StatisticParameters.java   
@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);
}
项目:vscrawler    文件:BerkeleyDBSeedManager.java   
private BloomFilter<Seed> getOrCreate(String segment) {
    BloomFilter<Seed> seedBloomFilter = bloomFilters.get(segment);
    if (seedBloomFilter != null) {
        return seedBloomFilter;
    }
    synchronized (segment.intern()) {
        seedBloomFilter = bloomFilters.get(segment);
        if (seedBloomFilter != null) {
            return seedBloomFilter;
        }

        long expectedNumber = NumberUtils.toLong(VSCrawlerContext.vsCrawlerConfigFileWatcher.loadedProperties()
                .getProperty(VSCrawlerConstant.VSCRAWLER_SEED_MANAGER_EXPECTED_SEED_NUMBER), 1000000L);

        // any way, build a filter instance if not exist
        seedBloomFilter = BloomFilter.create(new Funnel<Seed>() {
            @Override
            public void funnel(Seed from, PrimitiveSink into) {
                into.putString(seedKeyResolver.resolveSeedKey(from), Charset.defaultCharset());
            }
        }, expectedNumber);

        bloomFilters.put(segment, seedBloomFilter);
    }
    return seedBloomFilter;
}
项目:guava-probably    文件:CuckooFilterTest.java   
@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()));
}
项目:beam    文件:Watch.java   
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);
}
项目:openflowj-otn    文件:OFFlowRemovedVer14.java   
@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);
}
项目:openflowj-otn    文件:OFPortModVer12.java   
@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)
}
项目:openflowj-otn    文件:OFBsnGentableEntryStatsReplyVer14.java   
@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);
}
项目:openflowj-otn    文件:OFBsnGetMirroringReplyVer11.java   
@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)
}
项目:openflowj-otn    文件:OFFeaturesReplyVer14.java   
@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);
}
项目:openflowj-otn    文件:OFBsnBwEnableSetReplyVer12.java   
@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);
}
项目:openflowj-otn    文件:OFFlowRemovedVer13.java   
@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);
}
项目:openflowj-otn    文件:OFBsnVirtualPortCreateReplyVer12.java   
@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);
}
项目:openflowj-otn    文件:OFBsnGetMirroringReplyVer10.java   
@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)
}
项目:openflowj-otn    文件:OFBsnLacpStatsEntryVer13.java   
@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)
}
项目:openflowj-otn    文件:OFAggregateStatsReplyVer13.java   
@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)
}
项目:openflowj-otn    文件:OFBsnFlowIdleVer14.java   
@Override
public void funnel(OFBsnFlowIdleVer14 message, PrimitiveSink sink) {
    // fixed value property version = 5
    sink.putByte((byte) 0x5);
    // fixed value property type = 4
    sink.putByte((byte) 0x4);
    // FIXME: skip funnel of length
    sink.putLong(message.xid);
    // fixed value property experimenter = 0x5c16c7L
    sink.putInt(0x5c16c7);
    // fixed value property subtype = 0x28L
    sink.putInt(0x28);
    message.cookie.putTo(sink);
    sink.putInt(message.priority);
    message.tableId.putTo(sink);
    // skip pad (5 bytes)
    message.match.putTo(sink);
}
项目:open-rmbt    文件:PointTileParameters.java   
@Override
public void funnel(TileParameters o, PrimitiveSink into)
{
    super.funnel(o, into);
    if (o instanceof PointTileParameters)
    {
        final PointTileParameters _o = (PointTileParameters) o;
        into
            .putDouble(_o.pointDiameter)
            .putBoolean(_o.noFill)
            .putBoolean(_o.noColor);
        if (highlight != null)
            into.putUnencodedChars(highlight.toString());
    }
}
项目:open-rmbt    文件:TileParameters.java   
@Override
public void funnel(Path o, PrimitiveSink into)
{
    into
        .putInt(o.zoom)
        .putInt(o.x)
        .putInt(o.y);
}
项目:open-rmbt    文件:TileParameters.java   
@Override
public void funnel(Entry<String, String> o, PrimitiveSink into)
{
    into
        .putUnencodedChars(o.getKey())
        .putChar(':')
        .putUnencodedChars(Strings.nullToEmpty(o.getValue()));
}
项目:open-rmbt    文件:TileParameters.java   
@Override
public void funnel(TileParameters o, PrimitiveSink into)
{
    into
        .putUnencodedChars(o.getClass().getCanonicalName())
        .putInt(o.size)
        .putUnencodedChars(o.mapOption)
        .putFloat(o.quantile)
        .putDouble(o.transparency)
        .putUnencodedChars(Strings.nullToEmpty(o.developerCode));
    o.path.funnel(o.path, into);
    FILTER_MAP_FUNNEL.funnel(o.filterMap.entrySet(), into);
}
项目:openflowj-otn    文件:OFBucketVer14.java   
@Override
public void funnel(OFBucketVer14 message, PrimitiveSink sink) {
    // FIXME: skip funnel of length
    sink.putInt(message.weight);
    message.watchPort.putTo(sink);
    message.watchGroup.putTo(sink);
    // skip pad (4 bytes)
    FunnelUtils.putList(message.actions, sink);
}
项目:openflowj-otn    文件:OFMeterFeaturesStatsReplyVer13.java   
@Override
public void funnel(OFMeterFeaturesStatsReplyVer13 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 = 32
    sink.putShort((short) 0x20);
    sink.putLong(message.xid);
    // fixed value property statsType = 11
    sink.putShort((short) 0xb);
    OFStatsReplyFlagsSerializerVer13.putTo(message.flags, sink);
    // skip pad (4 bytes)
    message.features.putTo(sink);
}
项目:openflowj-otn    文件:OFPortStatsReplyVer10.java   
@Override
public void funnel(OFPortStatsReplyVer10 message, PrimitiveSink sink) {
    // fixed value property version = 1
    sink.putByte((byte) 0x1);
    // fixed value property type = 17
    sink.putByte((byte) 0x11);
    // FIXME: skip funnel of length
    sink.putLong(message.xid);
    // fixed value property statsType = 4
    sink.putShort((short) 0x4);
    OFStatsReplyFlagsSerializerVer10.putTo(message.flags, sink);
    FunnelUtils.putList(message.entries, sink);
}
项目:openflowj-otn    文件:OFBsnTlvTxPacketsVer13.java   
@Override
public void funnel(OFBsnTlvTxPacketsVer13 message, PrimitiveSink sink) {
    // fixed value property type = 0x3
    sink.putShort((short) 0x3);
    // fixed value property length = 12
    sink.putShort((short) 0xc);
    message.value.putTo(sink);
}
项目:openflowj-otn    文件:OFOxmBsnVrfMaskedVer14.java   
@Override
public void funnel(OFOxmBsnVrfMaskedVer14 message, PrimitiveSink sink) {
    // fixed value property typeLen = 0x30508L
    sink.putInt(0x30508);
    message.value.putTo(sink);
    message.mask.putTo(sink);
}
项目:openflowj-otn    文件:OFActionGroupVer13.java   
@Override
public void funnel(OFActionGroupVer13 message, PrimitiveSink sink) {
    // fixed value property type = 22
    sink.putShort((short) 0x16);
    // fixed value property length = 8
    sink.putShort((short) 0x8);
    message.group.putTo(sink);
}
项目:openflowj-otn    文件:OFBsnGetInterfacesRequestVer12.java   
@Override
public void funnel(OFBsnGetInterfacesRequestVer12 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 = 16
    sink.putShort((short) 0x10);
    sink.putLong(message.xid);
    // fixed value property experimenter = 0x5c16c7L
    sink.putInt(0x5c16c7);
    // fixed value property subtype = 0x9L
    sink.putInt(0x9);
}
项目:openflowj-otn    文件:OFBsnVirtualPortCreateRequestVer14.java   
@Override
public void funnel(OFBsnVirtualPortCreateRequestVer14 message, PrimitiveSink sink) {
    // fixed value property version = 5
    sink.putByte((byte) 0x5);
    // fixed value property type = 4
    sink.putByte((byte) 0x4);
    // FIXME: skip funnel of length
    sink.putLong(message.xid);
    // fixed value property experimenter = 0x5c16c7L
    sink.putInt(0x5c16c7);
    // fixed value property subtype = 0xfL
    sink.putInt(0xf);
    message.vport.putTo(sink);
}
项目:openflowj-otn    文件:OFMeterFeaturesStatsReplyVer14.java   
@Override
public void funnel(OFMeterFeaturesStatsReplyVer14 message, PrimitiveSink sink) {
    // fixed value property version = 5
    sink.putByte((byte) 0x5);
    // fixed value property type = 19
    sink.putByte((byte) 0x13);
    // fixed value property length = 32
    sink.putShort((short) 0x20);
    sink.putLong(message.xid);
    // fixed value property statsType = 11
    sink.putShort((short) 0xb);
    OFStatsReplyFlagsSerializerVer14.putTo(message.flags, sink);
    // skip pad (4 bytes)
    message.features.putTo(sink);
}
项目:openflowj-otn    文件:OFHelloVer13.java   
@Override
public void funnel(OFHelloVer13 message, PrimitiveSink sink) {
    // fixed value property version = 4
    sink.putByte((byte) 0x4);
    // fixed value property type = 0
    sink.putByte((byte) 0x0);
    // FIXME: skip funnel of length
    sink.putLong(message.xid);
    FunnelUtils.putList(message.elements, sink);
}
项目:openflowj-otn    文件:OFGroupFeaturesStatsRequestVer12.java   
@Override
public void funnel(OFGroupFeaturesStatsRequestVer12 message, PrimitiveSink sink) {
    // fixed value property version = 3
    sink.putByte((byte) 0x3);
    // fixed value property type = 18
    sink.putByte((byte) 0x12);
    // fixed value property length = 16
    sink.putShort((short) 0x10);
    sink.putLong(message.xid);
    // fixed value property statsType = 8
    sink.putShort((short) 0x8);
    OFStatsRequestFlagsSerializerVer12.putTo(message.flags, sink);
    // skip pad (4 bytes)
}
项目:openflowj-otn    文件:OFQueuePropMinRateVer12.java   
@Override
public void funnel(OFQueuePropMinRateVer12 message, PrimitiveSink sink) {
    // fixed value property type = 0x1
    sink.putShort((short) 0x1);
    // fixed value property length = 16
    sink.putShort((short) 0x10);
    // skip pad (4 bytes)
    sink.putInt(message.rate);
    // skip pad (6 bytes)
}
项目:openflowj-otn    文件:OFActionPopMplsVer14.java   
@Override
public void funnel(OFActionPopMplsVer14 message, PrimitiveSink sink) {
    // fixed value property type = 20
    sink.putShort((short) 0x14);
    // fixed value property length = 8
    sink.putShort((short) 0x8);
    message.ethertype.putTo(sink);
    // skip pad (2 bytes)
}
项目:openflowj-otn    文件:OFGroupDescStatsReplyVer13.java   
@Override
public void funnel(OFGroupDescStatsReplyVer13 message, PrimitiveSink sink) {
    // fixed value property version = 4
    sink.putByte((byte) 0x4);
    // fixed value property type = 19
    sink.putByte((byte) 0x13);
    // FIXME: skip funnel of length
    sink.putLong(message.xid);
    // fixed value property statsType = 7
    sink.putShort((short) 0x7);
    OFStatsReplyFlagsSerializerVer13.putTo(message.flags, sink);
    // skip pad (4 bytes)
    FunnelUtils.putList(message.entries, sink);
}
项目:openflowj-otn    文件:OFBsnVirtualPortRemoveReplyVer12.java   
@Override
public void funnel(OFBsnVirtualPortRemoveReplyVer12 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 = 20
    sink.putShort((short) 0x14);
    sink.putLong(message.xid);
    // fixed value property experimenter = 0x5c16c7L
    sink.putInt(0x5c16c7);
    // fixed value property subtype = 0x1aL
    sink.putInt(0x1a);
    sink.putLong(message.status);
}
项目:openflowj-otn    文件:OFOxmEthSrcMaskedVer14.java   
@Override
public void funnel(OFOxmEthSrcMaskedVer14 message, PrimitiveSink sink) {
    // fixed value property typeLen = 0x8000090cL
    sink.putInt((int) 0x8000090c);
    message.value.putTo(sink);
    message.mask.putTo(sink);
}
项目:openflowj-otn    文件:OFActionBsnSetTunnelDstVer11.java   
@Override
public void funnel(OFActionBsnSetTunnelDstVer11 message, PrimitiveSink sink) {
    // fixed value property type = 65535
    sink.putShort((short) 0xffff);
    // fixed value property length = 16
    sink.putShort((short) 0x10);
    // fixed value property experimenter = 0x5c16c7L
    sink.putInt(0x5c16c7);
    // fixed value property subtype = 0x2L
    sink.putInt(0x2);
    sink.putLong(message.dst);
}
项目:openflowj-otn    文件:OFOxmBsnUdf0MaskedVer12.java   
@Override
public void funnel(OFOxmBsnUdf0MaskedVer12 message, PrimitiveSink sink) {
    // fixed value property typeLen = 0x31108L
    sink.putInt(0x31108);
    message.value.putTo(sink);
    message.mask.putTo(sink);
}