Inheritance: System.IO.MemoryStream
Ejemplo n.º 1
0
        /**
         * @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);
                }
            }
        }
Ejemplo n.º 2
0
        /*
         * (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);
        }
Ejemplo n.º 3
0
        /*
         * (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);
        }
Ejemplo n.º 4
0
        /*
         * (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);
        }
Ejemplo n.º 5
0
        /*
         * (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);
        }
Ejemplo n.º 6
0
        /*
         * (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);
        }
Ejemplo n.º 7
0
        /*
         * (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);
        }
Ejemplo n.º 8
0
        /*
         * (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);
        }
Ejemplo n.º 9
0
        /*
         * (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);
        }
Ejemplo n.º 10
0
 /*
  * (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);
 }
Ejemplo n.º 11
0
 /*
  * (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);
 }
Ejemplo n.º 12
0
        /**
         * @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);
                }
            }
        }
Ejemplo n.º 13
0
 public override NetStreamStorage PackMessage(NetStreamStorage buffer, int startIndex, int endIndex)
 {
     return buffer;
 }
Ejemplo n.º 14
0
 /*
  * (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);
 }
Ejemplo n.º 15
0
 /*
  * (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);
 }
Ejemplo n.º 16
0
 /*
  * (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);
 }
Ejemplo n.º 17
0
 /*
  * (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);
 }
Ejemplo n.º 18
0
 /*
  * (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);
 }
Ejemplo n.º 19
0
 public override NetStreamStorage PackMessage(NetStreamStorage buffer, int startIndex, int endIndex)
 {
     return(buffer);
 }
Ejemplo n.º 20
0
 /*
  * (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);
 }