final FlowFilter udpFlows = new ProtoFilter(17);
final FlowFilter tcpFlows = new ProtoFilter(6);
/* TCP destination ports */
final AndFilter tcpDstFlows = new AndFilter();
tcpDstFlows.addFilter(tcpFlows);
tcpDstFlows.addFilter(dstWellKnownPorts);
statsRules.add(new PortDistributionRule(tcpDstFlows, new FileOutputStream("flowsTcpDstPorts.csv", true), true));
/* TCP source ports */
final AndFilter tcpSrcFlows = new AndFilter();
tcpSrcFlows.addFilter(tcpFlows);
tcpSrcFlows.addFilter(srcWellKnownPorts);
statsRules.add(new PortDistributionRule(tcpSrcFlows, new FileOutputStream("flowsTcpSrcPorts.csv", true), false));
/* UDP destination ports */
final AndFilter udpDstFlows = new AndFilter();
udpDstFlows.addFilter(udpFlows);
udpDstFlows.addFilter(dstWellKnownPorts);
statsRules.add(new PortDistributionRule(udpDstFlows, new FileOutputStream("flowsUdpDstPorts.csv", true), true));
/* UDP source ports */
final AndFilter udpSrcFlows = new AndFilter();
udpSrcFlows.addFilter(udpFlows);
udpSrcFlows.addFilter(srcWellKnownPorts);
statsRules.add(new PortDistributionRule(udpSrcFlows, new FileOutputStream("flowsUdpSrcPorts.csv", true), false));
/* UDP and TCP flows */
final OrFilter udpTcpFlows = new OrFilter();
udpTcpFlows.addFilter(udpFlows);