View Javadoc

1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2005 Kevin Rogers
4   //
5   // This file is part of MillScript.
6   //
7   // MillScript is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
20  ////////////////////////////////////////////////////////////////////////////////
21  package org.millscript.commons.vfs;
22  
23  import java.io.InputStream;
24  import java.io.OutputStream;
25  import java.io.Reader;
26  import java.io.Writer;
27  
28  /**
29   * This interface describes a file in the virtual filesystem.
30   */
31  public interface VFile extends VEntry {
32  
33      /**
34       * Returns an output stream for appending to the existing file contents.
35       *
36       * @return  an OutputStream ready to append to the file contents
37       */
38      OutputStream getAppendOutputStream();
39  
40      /**
41       * Returns a writer for appending to the existing file contents.
42       *
43       * @return  a Writer ready to append to the file contents
44       */
45      Writer getAppendWriter();
46  
47      /**
48       * Returns the MIME type for the contents of this file.
49       *
50       * @return  a String holding the MIME type for the contents of this file
51       */
52      String getContentMIMEType();
53  
54      /**
55       * Returns an input stream for reading the file contents.
56       *
57       * @return  an InputStream ready to read the file contents
58       */
59      InputStream getInputStream();
60  
61      /**
62       * Returns an ouptut stream for writing the file contents.
63       *
64       * @return  an OutputStream ready to write the file contents
65       */
66      OutputStream getOutputStream();
67  
68      /**
69       * Returns a reader for reading the file contents.
70       *
71       * @return  a Reader ready to read the file contents
72       */
73      Reader getReader();
74  
75      /**
76       * Returns a writer for writing the file contents.
77       *
78       * @return  a Writer ready to wrote the file contents
79       */
80      Writer getWriter();
81  
82      /**
83       * Returns this virtual file as a local entry, which may simply be this
84       * object. For example if this instance where a remote file accessed over
85       * HTTP, this method should cache the file and return a virtual file for
86       * that local copy.
87       *
88       * @return  a VEntry for a local copy of this entry 
89       */
90      VFile toLocal();
91  }