Package org.glassfish.tyrus.core.frame

Examples of org.glassfish.tyrus.core.frame.BinaryFrame


                       CompletionHandler<Frame> completionHandler, Boolean useTimeout) {
        return write(frame, completionHandler, useTimeout);
    }

    public Future<Frame> send(byte[] data) {
        return send(new BinaryFrame(data, false, true), null, true);
    }
View Full Code Here


    public Future<Frame> send(byte[] data) {
        return send(new BinaryFrame(data, false, true), null, true);
    }

    public void send(final byte[] data, final SendHandler handler) {
        send(new BinaryFrame(data, false, true), new CompletionHandler<Frame>() {
            @Override
            public void failed(Throwable throwable) {
                handler.onResult(new SendResult(throwable));
            }
View Full Code Here

    public Future<Frame> stream(boolean last, byte[] bytes, int off, int len) {
        if (sendingFragment) {
            if (last) {
                sendingFragment = false;
            }
            return send(new BinaryFrame(Arrays.copyOfRange(bytes, off, off + len), true, last));
        } else {
            sendingFragment = !last;
            return send(new BinaryFrame(Arrays.copyOfRange(bytes, off, off + len), false, last));
        }
    }
View Full Code Here

                // we need to let protocol handler execute extensions if there are any
                if (protocolHandler.hasExtensions()) {
                    byte[] tempFrame;

                    final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
                    final ByteBuffer byteBuffer = webSocket.getProtocolHandler().frame(dataFrame);
                    tempFrame = new byte[byteBuffer.remaining()];
                    byteBuffer.get(tempFrame);

                    final Future<Frame> frameFuture = webSocket.sendRawFrame(ByteBuffer.wrap(tempFrame));
                    futures.put(e.getValue(), frameFuture);

                } else {

                    if (frame == null) {
                        final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
                        final ByteBuffer byteBuffer = webSocket.getProtocolHandler().frame(dataFrame);
                        frame = new byte[byteBuffer.remaining()];
                        byteBuffer.get(frame);
                    }
View Full Code Here

                if (protocolHandler.hasExtensions()) {
                    byte[] tempFrame;
                    byte[] byteArrayMessage = new byte[message.remaining()];
                    message.get(byteArrayMessage);

                    final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
                    final ByteBuffer byteBuffer = remoteEndpoint.getSocket().getProtocolHandler().frame(dataFrame);
                    tempFrame = new byte[byteBuffer.remaining()];
                    byteBuffer.get(tempFrame);

                    final Future<Frame> frameFuture = remoteEndpoint.sendRawFrame(ByteBuffer.wrap(tempFrame));
                    futures.put(e.getValue(), frameFuture);

                } else {

                    if (frame == null) {
                        byte[] byteArrayMessage = new byte[message.remaining()];
                        message.get(byteArrayMessage);

                        final Frame dataFrame = new BinaryFrame(byteArrayMessage, false, true);
                        final ByteBuffer byteBuffer = remoteEndpoint.getSocket().getProtocolHandler().frame(dataFrame);
                        frame = new byte[byteBuffer.remaining()];
                        byteBuffer.get(frame);
                    }
View Full Code Here

                       CompletionHandler<Frame> completionHandler, Boolean useTimeout) {
        return write(frame, completionHandler, useTimeout);
    }

    public Future<Frame> send(byte[] data) {
        return send(new BinaryFrame(data, false, true), null, true);
    }
View Full Code Here

    public Future<Frame> send(byte[] data) {
        return send(new BinaryFrame(data, false, true), null, true);
    }

    public void send(final byte[] data, final SendHandler handler) {
        send(new BinaryFrame(data, false, true), new CompletionHandler<Frame>() {
            @Override
            public void failed(Throwable throwable) {
                handler.onResult(new SendResult(throwable));
            }
View Full Code Here

    public Future<Frame> stream(boolean last, byte[] bytes, int off, int len) {
        if (sendingFragment) {
            if (last) {
                sendingFragment = false;
            }
            return send(new BinaryFrame(Arrays.copyOfRange(bytes, off, off + len), true, last));
        } else {
            sendingFragment = !last;
            return send(new BinaryFrame(Arrays.copyOfRange(bytes, off, off + len), false, last));
        }
    }
View Full Code Here

TOP

Related Classes of org.glassfish.tyrus.core.frame.BinaryFrame

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.