Package org.graphstream.stream.netstream

Examples of org.graphstream.stream.netstream.NetStreamReceiver$DefaultUnpacker


  /**
   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    NetStreamReceiver net = null;
    try {
      net = new NetStreamReceiver("localhost", 2001, true);
    } catch (UnknownHostException e1) {
      System.err.println(e1.toString());
    } catch (IOException e1) {
      System.err.println(e1.toString());
    }

    ThreadProxyPipe pipe = net.getDefaultStream();

    pipe.addSink(new SinkAdapter() {
      public void graphAttributeAdded(String sourceId, long timeId,
          String attribute, Object value) {
        validate(attribute, value);
View Full Code Here


    //
    // - a graph that will display the received events
    Graph g = new MultiGraph("G",false,true);
    g.display();
    // - the receiver that waits for events
    NetStreamReceiver net = new NetStreamReceiver("localhost",2001,false);
   
    net.setUnpacker(new  Base64Unpacker());
   
    // - received events end up in the "default" pipe
    ThreadProxyPipe pipe = net.getStream("default");
    // - plug the pipe to the sink of the graph
    pipe.addSink(g);
    // -The receiver pro-actively checks for events on the ThreadProxyPipe
    while (true) {
      pipe.pump();
View Full Code Here

    //
    // - a graph that will display the received events
    Graph g = new MultiGraph("G");
    g.display();
    // - the receiver that waits for events
    NetStreamReceiver net = new NetStreamReceiver(2001);
   
    net.setUnpacker(new Base64Unpacker());
    net.setDebugOn(false);
   
    // - received events end up in the "default" pipe
    ThreadProxyPipe pipe = net.getDefaultStream();
    // - plug the pipe to the sink of the graph
    pipe.addSink(g);

    // ----- The sender side (in another thread) ------
    //
View Full Code Here

  /**
   * @param args
   * @throws InterruptedException
   */
  public static void main(String[] args) throws InterruptedException {
    NetStreamReceiver net = null;
    try {
      net = new NetStreamReceiver("localhost", 2001, true);
    } catch (UnknownHostException e1) {
      fail(e1.toString());
    } catch (IOException e1) {
      fail(e1.toString());
    }

    ThreadProxyPipe pipe = net.getDefaultStream();

    pipe.addSink(new Sink() {
      public void graphAttributeAdded(String sourceId, long timeId,
          String attribute, Object value) {
        assertEquals(0, value);
View Full Code Here

TOP

Related Classes of org.graphstream.stream.netstream.NetStreamReceiver$DefaultUnpacker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.