View Javadoc

1   /*
2    * Copyright (c) 2001-2003 The XDoclet team
3    * All rights reserved.
4    */
5   package xjavadoc.filesystem;
6   
7   import java.io.IOException;
8   import java.io.UnsupportedEncodingException;
9   import java.io.Writer;
10  import java.io.Reader;
11  import java.io.OutputStream;
12  import java.io.FileNotFoundException;
13  
14  /***
15   * An interface that allows XJavadoc to read and write from any
16   * source/destination and not just files.
17   *
18   * @author    <a href="dim@bigpond.net.au">Dmitri Colebatch</a>
19   * @created   September 25, 2002
20   */
21  public interface AbstractFile
22  {
23  
24  	/***
25  	 * Obtain a reader for the file.
26  	 *
27  	 * @return
28  	 * @exception IOException
29  	 */
30  	Reader getReader() throws IOException;
31  
32  	/***
33  	 * Obtain a writer for the file.
34  	 *
35  	 * @return
36  	 * @exception IOException
37  	 */
38  	Writer getWriter() throws IOException;
39  
40  	/***
41  	 * Determine if the file is writeable or not.
42  	 *
43  	 * @return
44  	 */
45  	boolean isWriteable();
46  
47  	/***
48  	 * Get the last modified timestamp of the file, or 0 if not available.
49  	 *
50  	 * @return
51  	 */
52  	long lastModified();
53  
54  	/***
55  	 * Get an outputstream for the file.
56  	 *
57  	 * @return
58  	 * @exception IOException
59  	 */
60  	OutputStream getOutputStream() throws IOException;
61  
62  	String getPath();
63  
64  	/***
65  	 * @param encoding
66  	 * @return
67  	 */
68  	public Reader getReader(String enc) throws UnsupportedEncodingException, FileNotFoundException;
69  }