public void write() { buffer.clear(); CoderResult cr = encoder.encode(message, buffer, true); if (cr.isError()) { throw new IllegalArgumentException(cr.toString()); } isDone = !cr.isOverflow(); buffer.flip(); endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); }
public void write() { buffer.clear(); CoderResult cr = encoder.encode(message, buffer, true); if (cr.isError()) { throw new IllegalArgumentException(cr.toString()); } isDone = !cr.isOverflow(); buffer.flip(); endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); }
public void write() { buffer.clear(); CoderResult cr = encoder.encode(message, buffer, true); if (cr.isError()) { throw new IllegalArgumentException(cr.toString()); } isDone = !cr.isOverflow(); buffer.flip(); endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); }
public void write() { buffer.clear(); CoderResult cr = encoder.encode(message, buffer, true); if (cr.isError()) { throw new IllegalArgumentException(cr.toString()); } isDone = !cr.isOverflow(); buffer.flip(); endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); }
public void write() { // FIXME: maybe not needed synchronized (buffer) { buffer.clear(); CoderResult cr = encoder.encode(message, buffer, true); if (cr.isError()) { throw new IllegalArgumentException(cr.toString()); } isDone = !cr.isOverflow(); buffer.flip(); endpoint.startMessage(Constants.OPCODE_TEXT, buffer, isDone && isLast, this); } }
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) { StateUpdateSendHandler sush = new StateUpdateSendHandler(handler); stateMachine.binaryStart(); startMessage(Constants.OPCODE_BINARY, data, true, sush); }
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) { if (data == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData")); } if (handler == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler")); } StateUpdateSendHandler sush = new StateUpdateSendHandler(handler); stateMachine.binaryStart(); startMessage(Constants.OPCODE_BINARY, data, true, sush); }
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) { if (data == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData")); } if (handler == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler")); } StateUpdateSendHandler sush = new StateUpdateSendHandler(handler, stateMachine); stateMachine.binaryStart(); startMessage(Constants.OPCODE_BINARY, data, true, sush); }
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) { if (data == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullData")); } if (handler == null) { throw new IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler")); } StateUpdateSendHandler sush = new StateUpdateSendHandler(handler, stateMachine); stateMachine.binaryStart(); startMessage(Constants.OPCODE_BINARY, data, true, sush); }
void startMessageBlock(byte opCode, ByteBuffer payload, boolean last) throws IOException { // Get the timeout before we send the message. The message may // trigger a session close and depending on timing the client // session may close before we can read the timeout. long timeout = getBlockingSendTimeout(); FutureToSendHandler f2sh = new FutureToSendHandler(wsSession); startMessage(opCode, payload, last, f2sh); try { if (timeout == -1) { f2sh.get(); } else { f2sh.get(timeout, TimeUnit.MILLISECONDS); } // FIXME: maybe not needed if (payload != null) { payload.clear(); } } catch (InterruptedException e) { throw new IOException(e); } catch (ExecutionException e) { throw new IOException(e); } catch (TimeoutException e) { throw new IOException(e); } }
void startMessageBlock(byte opCode, ByteBuffer payload, boolean last) throws IOException { // Get the timeout before we send the message. The message may // trigger a session close and depending on timing the client // session may close before we can read the timeout. long timeout = getBlockingSendTimeout(); FutureToSendHandler f2sh = new FutureToSendHandler(wsSession); startMessage(opCode, payload, last, f2sh); try { if (timeout == -1) { f2sh.get(); } else { f2sh.get(timeout, TimeUnit.MILLISECONDS); } } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException(e); } }
void startMessageBlock(byte opCode, ByteBuffer payload, boolean last) throws IOException { // Get the timeout before we send the message. The message may // trigger a session close and depending on timing the client // session may close before we can read the timeout. long timeout = getBlockingSendTimeout(); FutureToSendHandler f2sh = new FutureToSendHandler(wsSession, opCode == Constants.OPCODE_CLOSE); startMessage(opCode, payload, last, f2sh); try { if (timeout == -1) { f2sh.get(); } else { f2sh.get(timeout, TimeUnit.MILLISECONDS); } } catch (InterruptedException e) { handleSendFailure(e); } catch (ExecutionException e) { throw new IOException(e); } catch (TimeoutException e) { throw new IOException(e); } }
public void sendBytesByCompletion(ByteBuffer data, SendHandler handler) { if (data == null) { throw MESSAGES.invalidNullData(); } if (handler == null) { throw MESSAGES.invalidNullHandler(); } StateUpdateSendHandler sush = new StateUpdateSendHandler(handler); stateMachine.binaryStart(); startMessage(Constants.OPCODE_BINARY, data, true, sush); }