All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.edurt.datacap.pinot.org.jboss.netty.handler.codec.http.websocket.WebSocketFrame Maven / Gradle / Ivy

There is a newer version: 2024.03.6
Show newest version
/*
 * Copyright 2012 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.edurt.datacap.pinot.org.jboss.netty.handler.codec.http.websocket;

import io.edurt.datacap.pinot.org.jboss.netty.buffer.ChannelBuffer;
import io.edurt.datacap.pinot.org.jboss.netty.buffer.ChannelBuffers;

/**
 * @deprecated Use io.edurt.datacap.pinot.org.jboss.netty.handler.codec.http.websocketx instead.
 *
 * A Web Socket frame that represents either text or binary data.
 */
@Deprecated
public interface WebSocketFrame {

    /**
     * Closing handshake message (0xFF, 0x00)
     */
    WebSocketFrame CLOSING_HANDSHAKE = new DefaultWebSocketFrame(0xFF, ChannelBuffers.EMPTY_BUFFER);

    /**
     * Returns the type of this frame.
     * 0x00-0x7F means a text frame encoded in UTF-8, and
     * 0x80-0xFF means a binary frame.  Currently, {@code 0} is the
     * only allowed type according to the specification.
     */
    int getType();

    /**
     * Returns {@code true} if and only if the content of this frame is a string
     * encoded in UTF-8.
     */
    boolean isText();

    /**
     * Returns {@code true} if and only if the content of this frame is an
     * arbitrary binary data.
     */
    boolean isBinary();

    /**
     * Returns the content of this frame as-is, with no UTF-8 decoding.
     */
    ChannelBuffer getBinaryData();

    /**
     * Converts the content of this frame into a UTF-8 string and returns the
     * converted string.
     */
    String getTextData();

    /**
     * Sets the type and the content of this frame.
     *
     * @param type
     *        the type of the frame. {@code 0} is the only allowed type currently.
     * @param binaryData
     *        the content of the frame.  If (type & 0x80 == 0),
     *        it must be encoded in UTF-8.
     *
     * @throws IllegalArgumentException
     *         if If (type & 0x80 == 0) and the data is not encoded
     *         in UTF-8
     */
    void setData(int type, ChannelBuffer binaryData);

    /**
     * Returns the string representation of this frame.  Please note that this
     * method is not identical to {@link #getTextData()}.
     */
    String toString();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy