View Javadoc

1   /*
2    * Copyright (c) 2004-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.mercury.imap.response;
14  
15  import org.abstracthorizon.mercury.imap.IMAPSession;
16  
17  /**
18   * Numeric response
19   *
20   * @author Daniel Sendula
21   */
22  public class NumberResponse extends Response {
23  
24      /** Number */
25      protected int number;
26  
27      /** Mnemonic */
28      protected String mnemonic;
29  
30      /**
31       * Constructor
32       * @param session imap session
33       * @param mnemonic mnemonic
34       * @param number number
35       */
36      public NumberResponse(IMAPSession session, String mnemonic, int number) {
37          super(session, Response.UNTAGGED_RESPONSE);
38          append(number);
39          append(' ');
40          append(mnemonic);
41      }
42  
43      /**
44       * Constructor
45       * @param session imap session
46       * @param mnemonic mnemonic
47       * @param number nuimber
48       * @param tagged is tagged
49       */
50      public NumberResponse(IMAPSession session, String mnemonic, int number, boolean tagged) {
51          super(session, tagged ? Response.TAGGED_RESPONSE : Response.UNTAGGED_RESPONSE);
52          append(number);
53          append(' ');
54          append(mnemonic);
55      }
56  
57  }