View Javadoc

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