Create a text frame.

@param payload
The payload for a newly created frame.

@return
A WebSocket frame whose FIN bit is true, opcode is
{@link WebSocketOpcode#TEXT TEXT} and payload is
the given one.
510447
public static WebSocketFrame createTextFrame(String payload)
    {
        return new WebSocketFrame()
            .setFin(true)
            .setOpcode(TEXT)
            .setPayload(payload);
    }
497636
public Message createTextMessage(String text, String sender, String recipients) throws JMSException {
        return decorateMessage(getSession().createTextMessage(text), sender, recipients);
    }
703971
public static Message create( String text, Object data, ProcessingUnit owner  )
    {
        return new SimpleMessage( text, data, owner);
    }
1255359
private RTPFormat createFormat(int payload, Text description) {
		MediaType mtype = MediaType.fromDescription(mediaType);
		switch (mtype) {
		case AUDIO:
			return createAudioFormat(payload, description);
		case VIDEO:
			return createVideoFormat(payload, description);
		case APPLICATION:
			return createApplicationFormat(payload, description);
		default:
			return null;
		}
    }
937026
public void send(RoxPayload payload) {		
		try {
			if (isStarted()) {
				ByteArrayOutputStream baos = new ByteArrayOutputStream();

				new JsonSerializer().serializePayload(new OutputStreamWriter(baos), payload, false);

				socket.emit("payload", new String(baos.toByteArray()));
			}
			else {
				LOGGER.warn("Minirox is not available to send the test results");
			}
		}
		catch (Exception e) {
			LOGGER.warn("Unable to send the result to MINI ROX. Cause: {}", e.getMessage());
			
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Exception: ", e);
			}
		}
	}
742070
protected static byte[] toArray(ByteBuffer... payload) {
        if (payload.length == 1) {
            ByteBuffer buf = payload[0];
            if (buf.hasArray() && buf.arrayOffset() == 0 && buf.position() == 0) {
                return buf.array();
            }
        }
        int size = (int) Buffers.remaining(payload);
        byte[] data = new byte[size];
        for (ByteBuffer buf : payload) {
            buf.get(data);
        }
        return data;
    }
1005625
public boolean sendMessage( Serializable payload ) {
        if (!isOpen() || !multipleMembersInCluster()) {
            return false;
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("{0} SENDING {1} ", toString(), payload);
        }
        try {
            byte[] messageData = toByteArray(payload);
            Message jgMessage = new Message(null, channel.getAddress(), messageData);
            channel.send(jgMessage);
            return true;
        } catch (Exception e) {
            // Something went wrong here
            throw new SystemFailureException(ClusteringI18n.errorSendingMessage.text(clusterName()), e);
        }
    }
72747
public static Payload create(String data, @Nullable String metadata) {
    return create(
        ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, data),
        metadata == null ? null : ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, metadata));
  }
863803
public Object buildMessagePayload(TestContext context, String messageType) {
        this.getMessageInterceptors().add(gzipMessageConstructionInterceptor);
        this.getMessageInterceptors().add(binaryMessageConstructionInterceptor);
        return getPayloadContent(context, messageType);
    }
1336843
private final State onPayload(final Buffer buffer) {
        if (contentLength == 0) {
            return State.DONE;
        }

        if (buffer.getReadableBytes() >= contentLength) {
            try {
                payload = buffer.readBytes(contentLength);
            } catch (final IOException e) {
                throw new RuntimeException("Unable to read from stream due to IOException", e);
            }
            return State.DONE;
        }

        return State.GET_PAYLOAD;
    }
149302
public Element appendText(String text) {
        Validate.notNull(text);
        TextNode node = new TextNode(text);
        appendChild(node);
        return this;
    }
280125
public static <Payload> Message<Payload> create(Payload payload) {
    return new Message<>(payload, HashTreePMap.empty());
  }
142486
public void setPayload(java.util.Map<String, java.util.List<String>> payload) {
        this.payload = payload;
    }
488203
public static void sendTextBlocking(final ByteBuffer message, final WebSocketChannel wsChannel) throws IOException {
        sendBlockingInternal(message, WebSocketFrameType.TEXT, wsChannel);
    }
885740
function createFrame (type, payload) {
  var err = validateArgs(type, payload);
  if (err) { throw err; }

  var payloadBuffer = Buffer.isBuffer(payload) ? payload : new Buffer(payload);
  var headerBuffer  = createHeader(type, payload.length);

  return Buffer.concat([headerBuffer, payloadBuffer]);
}
830910
public ByteBuffer createMessage(boolean compress, int version)
    {
        int header = 0;
        // set compression bit.
        if (compress)
            header |= 4;
        // set streaming bit
        header |= 8;
        // Setting up the version bit
        header |= (version << 8);

        byte[] bytes;
        try
        {
            int size = (int)StreamInitMessage.serializer.serializedSize(this, version);
            DataOutputBuffer buffer = new DataOutputBuffer(size);
            StreamInitMessage.serializer.serialize(this, buffer, version);
            bytes = buffer.getData();
        }
        catch (IOException e)
        {
            throw new RuntimeException(e);
        }
        assert bytes.length > 0;

        ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length);
        buffer.putInt(MessagingService.PROTOCOL_MAGIC);
        buffer.putInt(header);
        buffer.put(bytes);
        buffer.flip();
        return buffer;
    }
1361512
public ByteBufHttpData writePayload(ByteBuf message) {
        verifyNotClosed();
        final boolean compressed = messageCompression && compressor != null;
        final int messageLength = message.readableBytes();
        try {
            final ByteBuf buf;
            if (messageLength != 0 && compressed) {
                buf = writeCompressed(message);
            } else {
                buf = writeUncompressed(message);
            }
            return new ByteBufHttpData(buf, false);
        } catch (IOException | RuntimeException e) {
            // IOException will not be thrown, since sink#deliverFrame doesn't throw.
            throw new ArmeriaStatusException(
                    StatusCodes.INTERNAL,
                    "Failed to frame message",
                    e);
        }
    }