1 | /* |
2 | * @(#) $Id: MessageDecoderResult.java 161459 2005-04-15 13:49:42Z trustin $ |
3 | * |
4 | * Copyright 2004 The Apache Software Foundation |
5 | * |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | * you may not use this file except in compliance with the License. |
8 | * You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, software |
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * See the License for the specific language governing permissions and |
16 | * limitations under the License. |
17 | * |
18 | */ |
19 | package org.apache.mina.protocol.codec; |
20 | |
21 | import org.apache.mina.common.ByteBuffer; |
22 | import org.apache.mina.protocol.ProtocolDecoderOutput; |
23 | import org.apache.mina.protocol.ProtocolSession; |
24 | |
25 | /** |
26 | * Represents results from {@link MessageDecoder}. |
27 | * |
28 | * @author The Apache Directory Project (dev@directory.apache.org) |
29 | * @author Trustin Lee (trustin@apache.org) |
30 | * @version $Rev: 161459 $, $Date: 2005-04-15 22:49:42 +0900 $ |
31 | * |
32 | * @see MessageDecoder |
33 | */ |
34 | public class MessageDecoderResult |
35 | { |
36 | /** |
37 | * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)} |
38 | * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}. |
39 | * Please refer to each method's documentation for detailed explanation. |
40 | */ |
41 | public static MessageDecoderResult OK = new MessageDecoderResult( "OK" ); |
42 | |
43 | /** |
44 | * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)} |
45 | * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}. |
46 | * Please refer to each method's documentation for detailed explanation. |
47 | */ |
48 | public static MessageDecoderResult NEED_DATA = new MessageDecoderResult( "NEED_DATA" ); |
49 | |
50 | /** |
51 | * Represents a result from {@link MessageDecoder#decodable(ProtocolSession, ByteBuffer)} |
52 | * and {@link MessageDecoder#decode(ProtocolSession, ByteBuffer, ProtocolDecoderOutput)}. |
53 | * Please refer to each method's documentation for detailed explanation. |
54 | */ |
55 | public static MessageDecoderResult NOT_OK = new MessageDecoderResult( "NOT_OK" ); |
56 | |
57 | private final String name; |
58 | |
59 | private MessageDecoderResult( String name ) |
60 | { |
61 | this.name = name; |
62 | } |
63 | |
64 | public String toString() |
65 | { |
66 | return name; |
67 | } |
68 | } |