/** * @param buff */ private void DoSend(NetStreamStorage buff) { if (!_client.Connected) { Console.Error.WriteLine("NetStreamSender : can't send. The socket is closed."); } else { buff.Flip(); NetStreamStorage buffer = _packer.PackMessage(buff); NetStreamStorage sizeBuffer = _packer.PackMessageSize(buffer.Capacity); buff.Position = 0; // real sending try { _outStream.Write(sizeBuffer.ToArray(), 0, sizeBuffer.Capacity); _outStream.Write(buffer.ToArray(), 0, buffer.Capacity); _outStream.Flush(); } catch (IOException e) { Console.Error.WriteLine(e.StackTrace); } } }
/* * (non-Javadoc) * * @see org.graphstream.stream.ElementSink#graphCleared(java.lang.String, * long) */ public void GraphClear(String sourceId, ulong timeId) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.Cleared). EncodeString(sourceId). EncodeNative(timeId); DoSend(buff); }
/* * (non-Javadoc) * * @see org.graphstream.stream.ElementSink#stepBegins(java.lang.String, * long, double) */ public void StepBegins(String sourceId, ulong timeId, double step) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.Step). EncodeString(sourceId). EncodeNative(timeId). EncodeNative(step); DoSend(buff); }
/* * (non-Javadoc) * * @see org.graphstream.stream.ElementSink#edgeRemoved(java.lang.String, * long, java.lang.String) */ public void RemoveEdge(String sourceId, ulong timeId, String edgeId) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.DelEdge). EncodeString(sourceId). EncodeNative(timeId). EncodeString(edgeId); DoSend(buff); }
/* * (non-Javadoc) * * @see org.graphstream.stream.ElementSink#nodeAdded(java.lang.String, long, * java.lang.String) */ public void AddNode(String sourceId, ulong timeId, String nodeId) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.AddNode). EncodeString(sourceId). EncodeNative(timeId). EncodeString(nodeId); DoSend(buff); }
/* * (non-Javadoc) * * @see * org.graphstream.stream.AttributeSink#graphAttributeRemoved(java.lang. * String, long, java.lang.String) */ public void RemoveGraphAttribute(String sourceId, ulong timeId, String attribute) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.DelGraphAttr). EncodeString(sourceId). EncodeNative(timeId). EncodeString(attribute); DoSend(buff); }
/* * (non-Javadoc) * * @see * org.graphstream.stream.AttributeSink#graphAttributeAdded(java.lang.String * , long, java.lang.String, java.lang.Object) */ public void AddGraphAttribute(String sourceId, ulong timeId, String attribute, Object value) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.AddGraphAttr). EncodeString(sourceId). EncodeNative(timeId). EncodeString(attribute). EncodeValueWithType(value); DoSend(buff); }
/* * (non-Javadoc) * * @see org.graphstream.stream.ElementSink#edgeAdded(java.lang.String, long, * java.lang.String, java.lang.String, java.lang.String, boolean) */ public void AddEdge(String sourceId, ulong timeId, String edgeId, String fromNodeId, String toNodeId, bool directed) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.AddEdge). EncodeString(sourceId). EncodeNative(timeId). EncodeString(edgeId). EncodeString(fromNodeId). EncodeString(toNodeId). EncodeNative(directed); DoSend(buff); }
/* * (non-Javadoc) * * @see * org.graphstream.stream.AttributeSink#edgeAttributeChanged(java.lang.String * , long, java.lang.String, java.lang.String, java.lang.Object, * java.lang.Object) */ public void ChangeEdgeAttribute(String sourceId, ulong timeId, String edgeId, String attribute, Object oldValue, Object newValue) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.ChgEdgeAttr). EncodeString(sourceId). EncodeNative(timeId). EncodeString(edgeId). EncodeString(attribute). EncodeValueWithType(oldValue). EncodeValueWithType(newValue); DoSend(buff); }
public override NetStreamStorage PackMessage(NetStreamStorage buffer, int startIndex, int endIndex) { return buffer; }
/* * (non-Javadoc) * * @see * org.graphstream.stream.AttributeSink#nodeAttributeRemoved(java.lang.String * , long, java.lang.String, java.lang.String) */ public void RemoveNodeAttribute(String sourceId, ulong timeId, String nodeId, String attribute) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.DelNodeAttr). EncodeString(sourceId). EncodeNative(timeId). EncodeString(nodeId). EncodeString(attribute); DoSend(buff); }
/* * (non-Javadoc) * * @see * org.graphstream.stream.AttributeSink#nodeAttributeChanged(java.lang.String * , long, java.lang.String, java.lang.String, java.lang.Object, * java.lang.Object) */ public void ChangeNodeAttribute(String sourceId, ulong timeId, String nodeId, String attribute, Object oldValue, Object newValue) { NetStreamStorage buff = new NetStreamStorage(). EncodeArray(_streamIdArray). EncodeEvent(NetStreamEvent.ChgNodeAttr). EncodeString(sourceId). EncodeNative(timeId). EncodeString(nodeId). EncodeString(attribute). EncodeValueWithType(oldValue). EncodeValueWithType(newValue); DoSend(buff); }
public override NetStreamStorage PackMessage(NetStreamStorage buffer, int startIndex, int endIndex) { return(buffer); }