1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 }