View Javadoc

    1   /*******************************************************************************
    2    * Copyright (c) 2011 Michael Mimo Moratti.
    3    *
    4    * Michael Mimo Moratti licenses this file to you under the Apache License, version 2.0
    5    * (the "License"); you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at:
    7    *     http://www.apache.org/licenses/LICENSE-2.0
    8    * Unless required by applicable law or agreed to in writing, software
    9    * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    10   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
    11   * License for the specific language governing permissions and limitations
    12   * under the License.
    13   *******************************************************************************/
    14  package ch.mimo.netty.handler.codec.icap;
    15
    16  /**
    17   * State Enum which contains all Decoder states.
    18   *
    19   * @author Michael Mimo Moratti (mimo@mimo.ch)
    20   *
    21   * @see IcapMessageDecoder
    22   */
    23  public enum StateEnum {
    24  	SKIP_CONTROL_CHARS(new SkipControlCharsState("SKIP_CONTROL_CHARS")),
    25  	READ_ICAP_INITIAL_STATE(new ReadIcapInitialState("READ_ICAP_INITIAL_STATE")),
    26  	READ_ICAP_HEADER_STATE(new ReadIcapHeaderState("READ_ICAP_HEADER_STATE")),
    27  	READ_HTTP_REQUEST_INITIAL_AND_HEADERS(new ReadHttpRequestInitialAndHeadersState("READ_HTTP_REQUEST_INITIAL_AND_HEADERS")),
    28  	READ_HTTP_RESPONSE_INITIAL_AND_HEADERS(new ReadHttpResponseInitalAndHeadersState("READ_HTTP_RESPONSE_INITIAL_AND_HEADERS")),
    29  	READ_CHUNK_SIZE_STATE(new ReadChunkSizeState("READ_CHUNK_SIZE_STATE")),
    30  	READ_CHUNK_STATE(new ReadChunkState("READ_CHUNK_STATE")),
    31  	READ_CHUNKED_CONTENT_AS_CHUNKS_STATE(new ReadChunkedContentAsChunksState("READ_CHUNKED_CONTENT_AS_CHUNKS_STATE")),
    32  	READ_CHUNK_DELIMITER_STATE(new ReadChunkDelimiterState("READ_CHUNK_DELIMITER_STATE")),
    33  	READ_TRAILING_HEADERS_STATE(new ReadTrailingHeadersState("READ_TRAILING_HEADERS_STATE"));
    34
    35  	private State<? extends Object> state;
    36
    37  	StateEnum(State<? extends Object> state) {
    38  		this.state = state;
    39  	}
    40
    41  	public State<? extends Object> getState() {
    42  		return state;
    43  	}
    44
    45  	public String toString() {
    46  		return this.name();
    47  	}
    48  }