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.mime.zip;
22
23 import org.millscript.commons.vfs.AbstractVFile;
24 import org.millscript.commons.vfs.VFolder;
25
26 import java.io.InputStream;
27 import java.io.OutputStream;
28 import java.util.zip.ZipEntry;
29
30 /**
31 * This class implements a virtual filesystem file for a read-only zip file
32 * file.
33 */
34 public class ReadOnlyZipFile extends AbstractVFile< ReadOnlyZipVolume > {
35
36 /**
37 * Constructs a new virtual filesystem file with the specified name,
38 * parent folder and volume.
39 *
40 * @param vol the volume this entry is held on
41 * @param parent the parent folder for this file
42 * @param name the name of the file
43 */
44 ReadOnlyZipFile( final ReadOnlyZipVolume vol, final VFolder parent, final String name ) {
45 super( vol, parent, name );
46 }
47
48 /**
49 * Constructs a new virtual filesystem file with the specified name,
50 * parent folder. This file will belong to the same volume as the specified
51 * parent folder.
52 *
53 * @param parent the parent folder for this file
54 * @param name the name of the file
55 */
56 ReadOnlyZipFile( final ReadOnlyZipFolder parent, final String name ) {
57 super( parent.getVolume(), parent, name );
58 }
59
60 /**
61 * @see org.millscript.commons.vfs.VEntry#exists()
62 */
63 public boolean exists() {
64 if ( this.getZipEntry() == null ) {
65 return false;
66 }
67 return true;
68 }
69
70 /**
71 * @see org.millscript.commons.vfs.VFile#getAppendOutputStream()
72 */
73 public OutputStream getAppendOutputStream() {
74
75 return null;
76 }
77
78 /**
79 * @see org.millscript.commons.vfs.VFile#getInputStream()
80 */
81 public InputStream getInputStream() {
82
83 return null;
84 }
85
86 /**
87 * Returns the ZipEntry for this file.
88 *
89 * @return the ZipEntry for this file, or <code>null</code> if it doesn't
90 * exist
91 */
92 final ZipEntry getZipEntry() {
93 return this.getVolume().getZipEntry( this.getRelativePathOnVolume() );
94 }
95
96 /**
97 * @see org.millscript.commons.vfs.VFile#getOutputStream()
98 */
99 public OutputStream getOutputStream() {
100
101 return null;
102 }
103
104 }