Search in sources :

Example 1 with NotSendableException

use of org.java_websocket.exceptions.NotSendableException in project quorrabot by GloriousEggroll.

the class Draft_10 method createFrames.

@Override
public List<Framedata> createFrames(String text, boolean mask) {
    FrameBuilder curframe = new FramedataImpl1();
    try {
        curframe.setPayload(ByteBuffer.wrap(Charsetfunctions.utf8Bytes(text)));
    } catch (InvalidDataException e) {
        throw new NotSendableException(e);
    }
    curframe.setFin(true);
    curframe.setOptcode(Opcode.TEXT);
    curframe.setTransferemasked(mask);
    return Collections.singletonList((Framedata) curframe);
}
Also used : InvalidDataException(org.java_websocket.exceptions.InvalidDataException) CloseFrameBuilder(org.java_websocket.framing.CloseFrameBuilder) FrameBuilder(org.java_websocket.framing.FrameBuilder) NotSendableException(org.java_websocket.exceptions.NotSendableException) FramedataImpl1(org.java_websocket.framing.FramedataImpl1)

Example 2 with NotSendableException

use of org.java_websocket.exceptions.NotSendableException in project quorrabot by GloriousEggroll.

the class Draft_10 method createFrames.

@Override
public List<Framedata> createFrames(ByteBuffer binary, boolean mask) {
    FrameBuilder curframe = new FramedataImpl1();
    try {
        curframe.setPayload(binary);
    } catch (InvalidDataException e) {
        throw new NotSendableException(e);
    }
    curframe.setFin(true);
    curframe.setOptcode(Opcode.BINARY);
    curframe.setTransferemasked(mask);
    return Collections.singletonList((Framedata) curframe);
}
Also used : InvalidDataException(org.java_websocket.exceptions.InvalidDataException) CloseFrameBuilder(org.java_websocket.framing.CloseFrameBuilder) FrameBuilder(org.java_websocket.framing.FrameBuilder) NotSendableException(org.java_websocket.exceptions.NotSendableException) FramedataImpl1(org.java_websocket.framing.FramedataImpl1)

Example 3 with NotSendableException

use of org.java_websocket.exceptions.NotSendableException in project quorrabot by GloriousEggroll.

the class Draft_75 method createFrames.

@Override
public List<Framedata> createFrames(String text, boolean mask) {
    FrameBuilder frame = new FramedataImpl1();
    try {
        frame.setPayload(ByteBuffer.wrap(Charsetfunctions.utf8Bytes(text)));
    } catch (InvalidDataException e) {
        throw new NotSendableException(e);
    }
    frame.setFin(true);
    frame.setOptcode(Opcode.TEXT);
    frame.setTransferemasked(mask);
    return Collections.singletonList((Framedata) frame);
}
Also used : InvalidDataException(org.java_websocket.exceptions.InvalidDataException) FrameBuilder(org.java_websocket.framing.FrameBuilder) NotSendableException(org.java_websocket.exceptions.NotSendableException) FramedataImpl1(org.java_websocket.framing.FramedataImpl1)

Aggregations

InvalidDataException (org.java_websocket.exceptions.InvalidDataException)3 NotSendableException (org.java_websocket.exceptions.NotSendableException)3 FrameBuilder (org.java_websocket.framing.FrameBuilder)3 FramedataImpl1 (org.java_websocket.framing.FramedataImpl1)3 CloseFrameBuilder (org.java_websocket.framing.CloseFrameBuilder)2