Search in sources :

Example 1 with Link

use of streamer.Link in project cloudstack by apache.

the class FakeSource method main.

/**
     * Example.
     */
public static void main(String[] args) {
    Element fakeSource = new FakeSource("source 3/10/100") {

        {
            verbose = true;
            incommingBufLength = 3;
            numBuffers = 10;
            delay = 100;
        }
    };
    Element fakeSink = new FakeSink("sink") {

        {
            verbose = true;
        }
    };
    Element fakeSink2 = new FakeSink("sink2") {

        {
            verbose = true;
        }
    };
    Link link = new SyncLink();
    fakeSource.setLink(STDOUT, link, Direction.OUT);
    fakeSink.setLink(STDIN, link, Direction.IN);
    Link link2 = new SyncLink();
    fakeSource.setLink("out2", link2, Direction.OUT);
    fakeSink2.setLink(STDIN, link2, Direction.IN);
    link.sendEvent(Event.STREAM_START, Direction.IN);
    link.run();
}
Also used : Element(streamer.Element) BaseElement(streamer.BaseElement) SyncLink(streamer.SyncLink) SyncLink(streamer.SyncLink) Link(streamer.Link)

Example 2 with Link

use of streamer.Link in project cloudstack by apache.

the class MockSink method main.

/**
     * Example.
     */
public static void main(String[] args) {
    Element mockSource = new MockSource("source") {

        {
            bufs = new ByteBuffer[] { new ByteBuffer(new byte[] { 1, 1, 2, 3, 4, 5 }), new ByteBuffer(new byte[] { 2, 1, 2, 3, 4 }), new ByteBuffer(new byte[] { 3, 1, 2, 3 }), new ByteBuffer(new byte[] { 4, 1, 2 }), new ByteBuffer(new byte[] { 5, 1 }) };
            verbose = true;
            delay = 100;
            numBuffers = bufs.length;
        }
    };
    Element mockSink = new MockSink("sink") {

        {
            bufs = new ByteBuffer[] { new ByteBuffer(new byte[] { 1, 1, 2, 3, 4, 5 }), new ByteBuffer(new byte[] { 2, 1, 2, 3, 4 }), new ByteBuffer(new byte[] { 3, 1, 2, 3 }), new ByteBuffer(new byte[] { 4, 1, 2 }), new ByteBuffer(new byte[] { 5, 1 }) };
            verbose = true;
        }
    };
    Link link = new SyncLink() {

        {
            verbose = true;
        }
    };
    mockSource.setLink(STDOUT, link, Direction.OUT);
    mockSink.setLink(STDIN, link, Direction.IN);
    link.run();
}
Also used : Element(streamer.Element) BaseElement(streamer.BaseElement) SyncLink(streamer.SyncLink) ByteBuffer(streamer.ByteBuffer) SyncLink(streamer.SyncLink) Link(streamer.Link)

Example 3 with Link

use of streamer.Link in project cloudstack by apache.

the class MockSource method main.

/**
     * Example.
     */
public static void main(String[] args) {
    Element mockSource = new MockSource("source") {

        {
            bufs = new ByteBuffer[] { new ByteBuffer(new byte[] { 1, 1, 2, 3, 4, 5 }), new ByteBuffer(new byte[] { 2, 1, 2, 3, 4 }), new ByteBuffer(new byte[] { 3, 1, 2, 3 }), new ByteBuffer(new byte[] { 4, 1, 2 }), new ByteBuffer(new byte[] { 5, 1 }) };
            verbose = true;
            delay = 100;
        // this.numBuffers = this.bufs.length;
        }
    };
    Element fakeSink = new FakeSink("sink") {

        {
            verbose = true;
        }
    };
    Link link = new SyncLink();
    mockSource.setLink(STDOUT, link, Direction.OUT);
    fakeSink.setLink(STDIN, link, Direction.IN);
    link.run();
}
Also used : Element(streamer.Element) SyncLink(streamer.SyncLink) ByteBuffer(streamer.ByteBuffer) SyncLink(streamer.SyncLink) Link(streamer.Link)

Aggregations

Element (streamer.Element)3 Link (streamer.Link)3 SyncLink (streamer.SyncLink)3 BaseElement (streamer.BaseElement)2 ByteBuffer (streamer.ByteBuffer)2