Package streamer

Examples of streamer.Element


    /**
     * Example.
     */
    public static void main(String args[]) {

        Element fakeSource = new FakeSource("source 3/10/100") {
            {
                verbose = true;
                this.incommingBufLength = 3;
                this.numBuffers = 10;
                this.delay = 100;
            }
        };

        Element fakeSink = new FakeSink("sink") {
            {
                this.verbose = true;
            }
        };

        Element fakeSink2 = new FakeSink("sink2") {
            {
                this.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();

    }
View Full Code Here


    /**
     * Example.
     */
    public static void main(String args[]) {

        Element mockSource = new MockSource("source") {
            {
                this.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})};
                this.verbose = true;
                this.delay = 100;
                // this.numBuffers = this.bufs.length;
            }
        };

        Element fakeSink = new FakeSink("sink") {
            {
                this.verbose = true;
            }
        };

        Link link = new SyncLink();

        mockSource.setLink(STDOUT, link, Direction.OUT);
        fakeSink.setLink(STDIN, link, Direction.IN);

        link.run();
    }
View Full Code Here

        0x00, 0x00//  CLIPRDR_LONG_FORMAT_NAME::formatName = ""
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element router = new ServerClipRdrChannelRouter("router");
        ClipboardState state = new ClipboardState();
        state.serverUseLongFormatNames = true;
        Element format_list = new ServerFormatListPDU("format_list", state);

        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {
                // Format List Response PDU
                0x03, 0x00, // CLIPRDR_HEADER::msgType = CB_FORMAT_LIST_RESPONSE (3)
                0x01, 0x00, // CLIPRDR_HEADER::msgFlags = 0x0001 = CB_RESPONSE_OK
                0x00, 0x00, 0x00, 0x00, // CLIPRDR_HEADER::dataLen = 0 bytes
        }, new byte[] {
View Full Code Here

        0x00, 0x00, 0x00, 0x00//  CLIPRDR_HEADER::dataLen = 0 bytes
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element router = new ServerClipRdrChannelRouter("router");
        ClipboardState state = new ClipboardState();
        Element monitor_ready = new ServerMonitorReadyPDU("monitor_ready", state);
        Element sink = new MockSink("sink", new ByteBuffer[] {});

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, router, monitor_ready, sink);
        pipeline.link("source", "router >monitor_ready", "monitor_ready", "sink");
        pipeline.runMainLoop("source", STDOUT, false, false);
View Full Code Here

    /**
     * Example.
     */
    public static void main(String args[]) {

        Element mockSource = new MockSource("source") {
            {
                this.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})};
                this.verbose = true;
                this.delay = 100;
                this.numBuffers = this.bufs.length;
            }
        };

        Element mockSink = new MockSink("sink") {
            {
                this.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})};
                this.verbose = true;
            }
        };

        Link link = new SyncLink() {
            {
                this.verbose = true;
            }
        };

        mockSource.setLink(STDOUT, link, Direction.OUT);
        mockSink.setLink(STDIN, link, Direction.IN);

        link.run();
    }
View Full Code Here

        0x0e, 0x00, 0x00, 0x00//  CLIPRDR_GENERAL_CAPABILITY::capabilityFlags = 0x0000000e = 0x02 |0x04 |0x08 = CB_USE_LONG_FORMAT_NAMES | CB_STREAM_FILECLIP_ENABLED | CB_FILECLIP_NO_FILE_PATHS
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element router = new ServerClipRdrChannelRouter("router");
        ClipboardState state = new ClipboardState();
        Element clip_cap = new ServerClipboardCapabilitiesPDU("clip_cap", state);
        Element sink = new MockSink("sink", new ByteBuffer[] {});

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, router, clip_cap, sink);
        pipeline.link("source", "router >clipboard_capabilities", "clip_cap", "sink");
        pipeline.runMainLoop("source", STDOUT, false, false);
View Full Code Here

       
    };
    /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));
        Element todo = new ClientSynchronizePDU("TODO");
        Element x224 = new ClientX224DataPDU("x224");
        Element tpkt = new ClientTpkt("tpkt");
        Element sink = new MockSink("sink", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element mainSink = new MockSink("mainSink", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, todo, x224, tpkt, sink, mainSink);
        pipeline.link("source", "TODO", "mainSink");
        pipeline.link("TODO >" + OTOUT, "x224", "tpkt", "sink");
View Full Code Here

                }
            });

            // Assemble pipeline
            InetSocketAddress address;
            Element main;
            switch (protocol) {
            case VNC:
                address = new InetSocketAddress(hostName.value, vncPort.value);
                main = new VncClient("client", password.value, screen, canvas);
                break;
            case RDP:
                address = new InetSocketAddress(hostName.value, rdpPort.value);
                main = new RdpClient("client", hostName.value, domain.value, userName.value, rdpPassword.value, null, screen, canvas, sslState);
                break;
            case HYPERV:
                address = new InetSocketAddress(hostName.value, hyperVPort.value);
                main = new RdpClient("client", hostName.value, domain.value, userName.value, password.value, hyperVInstanceId.value, screen, canvas, sslState);
                break;
            default:
                address = null;
                main = null;
            }

            Pipeline pipeline = new PipelineImpl("Client");
            pipeline.add(socket, main);
            pipeline.link("socket", main.getId(), "socket");

            pipeline.validate();

            frame = createVncClientMainWindow(canvas, protocol.toString() + " " + hostName.value, new WindowAdapter() {
                public void windowClosing(WindowEvent evt) {
View Full Code Here

    public static void main(String args[]) {
        System.setProperty("streamer.Element.debug", "true");

        BufferedImageCanvas canvas = new BufferedImageCanvas(4, 4);

        Element renderer = new BufferedImagePixelsAdapter("renderer", canvas);

        byte[] pixels = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5,
                6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};

        int[] pixelsLE = new int[] {0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605,
                0x0c0b0a09, 0x100f0e0d, 0x04030201, 0x08070605, 0x0c0b0a09, 0x100f0e0d};

        ByteBuffer buf = new ByteBuffer(pixels);
        buf.putMetadata(TARGET_X, 0);
        buf.putMetadata(TARGET_Y, 0);
        buf.putMetadata(WIDTH, 4);
        buf.putMetadata(HEIGHT, 4);
        buf.putMetadata(PIXEL_FORMAT, RGB888LE32);

        renderer.handleData(buf, null);

        String actualData = Arrays.toString(((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData());
        String expectedData = Arrays.toString(pixelsLE);
        if (!actualData.equals(expectedData))
            System.err.println("Actual image:   " + actualData + "\nExpected image: " + expectedData + ".");
View Full Code Here

    public static void main(String args[]) {
        System.setProperty("streamer.Element.debug", "true");

        BufferedImageCanvas canvas = new BufferedImageCanvas(4, 4);

        Element renderer = new BufferedImageCopyRectAdapter("renderer", canvas);

        int[] pixelsBeforeCopy = new int[] {
                // 0
                1, 2, 3, 4,
                // 1
                5, 6, 7, 8,
                // 2
                9, 10, 11, 12,
                // 3
                13, 14, 15, 16};
        int[] pixelsAfterCopy = new int[] {
                // 0
                11, 12, 3, 4,
                // 1
                15, 16, 7, 8,
                // 2
                9, 10, 11, 12,
                // 3
                13, 14, 15, 16};

        // Initalize image
        int[] data = ((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData();
        System.arraycopy(pixelsBeforeCopy, 0, data, 0, pixelsBeforeCopy.length);

        ByteBuffer buf = new ByteBuffer(new byte[0]);
        buf.putMetadata(TARGET_X, 0);
        buf.putMetadata(TARGET_Y, 0);
        buf.putMetadata(WIDTH, 2);
        buf.putMetadata(HEIGHT, 2);
        buf.putMetadata(SRC_X, 2);
        buf.putMetadata(SRC_Y, 2);

        renderer.handleData(buf, null);

        data = ((DataBufferInt)canvas.getOfflineImage().getRaster().getDataBuffer()).getData();
        String actualData = Arrays.toString(data);
        String expectedData = Arrays.toString(pixelsAfterCopy);
        if (!actualData.equals(expectedData))
View Full Code Here

TOP

Related Classes of streamer.Element

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.