Package streamer

Examples of streamer.Element


        ByteBuffer packet = new ByteBuffer(new byte[] {0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x10, 0x00,
                0x01, 0x04, 0x0a, 0x00, 0x0c, (byte)0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});

        Pipeline pipeline = new PipelineImpl("test");

        Element bitmap = new ServerBitmapUpdate("bitmap");

        BufferedImageCanvas canvas = new BufferedImageCanvas(1024, 768);
        Element adapter = new AwtCanvasAdapter("test", canvas, null) {
            {
                verbose = true;
            }
        };
        pipeline.addAndLink(bitmap, adapter);
View Full Code Here


        pipeline.validate();
    }

    private Element setMainElementAndAddressBasedOnProtocol(Protocol protocol, SSLState sslState) {
        Element main;
        switch (protocol) {
        case VNC:
            address = new InetSocketAddress(hostName.value, vncPort.value);
            main = new VncClient("client", password.value, screen, canvas);
            break;
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

        /* @formatter:on */

        NtlmState state = new NtlmState();

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(new byte[] {1, 2, 3}));
        Element ntlmssp_negotiate = new ClientNtlmsspNegotiate("ntlmssp_negotiate", state);
        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, ntlmssp_negotiate, sink, mainSink);
        pipeline.link("source", "ntlmssp_negotiate", "mainSink");
        pipeline.link("ntlmssp_negotiate >" + OTOUT, "sink");
View Full Code Here

                0x72, 0x00, 0x6c, 0x00, 0x64, 0x00, 0x00, 0x00//  CLIPRDR_FORMAT_DATA_RESPONSE::requestedFormatData: "hello world"
        };
        /* @formatter:on */

        MockSource source = new MockSource("source", ByteBuffer.convertByteArraysToByteBuffers(packet));
        Element router = new ServerClipRdrChannelRouter("router");
        ClipboardState state = new ClipboardState();
        state.serverRequestedFormat = new ClipboardDataFormat(ClipboardDataFormat.CB_FORMAT_UNICODETEXT, "");
        Element format_data_response = new ServerFormatDataResponsePDU("format_data_response", state);

        ByteBuffer clipboardAdapterPacket = new ByteBuffer(0);
        clipboardAdapterPacket.putMetadata(AwtClipboardAdapter.CLIPBOARD_CONTENT, "hello world");
        Element sink = new MockSink("sink", new ByteBuffer[] {clipboardAdapterPacket});

        Pipeline pipeline = new PipelineImpl("test");
        pipeline.add(source, router, format_data_response, sink);
        pipeline.link("source", "router >format_data_response", "format_data_response >clipboard", "sink");
        pipeline.runMainLoop("source", STDOUT, false, false);
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

                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

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

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

        byte[] data = new byte[] {1, 2, 3};
        ByteBuffer buf = new ByteBuffer(data);
        sink.setLink(STDIN, new SyncLink(), Direction.IN);
        sink.getLink(STDIN).sendData(buf);

    }
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.