View Javadoc

1   /************************************************************************
2    * Copyright (c) 2000-2006 The Apache Software Foundation.             *
3    * All rights reserved.                                                *
4    * ------------------------------------------------------------------- *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you *
6    * may not use this file except in compliance with the License. You    *
7    * may obtain a copy of the License at:                                *
8    *                                                                     *
9    *     http://www.apache.org/licenses/LICENSE-2.0                      *
10   *                                                                     *
11   * Unless required by applicable law or agreed to in writing, software *
12   * distributed under the License is distributed on an "AS IS" BASIS,   *
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or     *
14   * implied.  See the License for the specific language governing       *
15   * permissions and limitations under the License.                      *
16   ***********************************************************************/
17  
18  package org.apache.james.nntpserver.repository;
19  
20  import java.io.OutputStream;
21  
22  /*** 
23   * Contract exposed by a NewsGroup Article
24   */
25  public interface NNTPArticle {
26  
27      /***
28       * Gets the group containing this article.
29       *
30       * @return the group
31       */
32      NNTPGroup getGroup();
33  
34      /***
35       * Gets the article number for this article.
36       *
37       * @return the article number
38       */
39      int getArticleNumber();
40  
41      /***
42       * Gets the unique message id for this article.
43       *
44       * @return the message id
45       */
46      String getUniqueID();
47  
48      /***
49       * Writes the whole article to a writer.
50       *
51       * @param wrt the OutputStream to which the article is written.
52       */
53      void writeArticle(OutputStream wrt);
54  
55      /***
56       * Writes the article headers to a writer.
57       *
58       * @param wrt the OutputStream to which the article is written.
59       */
60      void writeHead(OutputStream wrt);
61  
62      /***
63       * Writes the article body to a writer.
64       *
65       * @param wrt the OutputStream to which the article is written.
66       */
67      void writeBody(OutputStream wrt);
68  
69      /***
70       * Writes the article overview to a writer.
71       *
72       * @param wrt the OutputStream to which the article is written.
73       */
74      void writeOverview(OutputStream wrt);
75  
76      /***
77       * Gets the header with the specified headerName.  Returns null
78       * if the header doesn't exist.
79       *
80       * @param headerName the name of the header being retrieved.
81       */
82      String getHeader(String headerName);
83  }