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.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          // TODO Auto-generated method stub
75          return null;
76      }
77  
78      /**
79       * @see org.millscript.commons.vfs.VFile#getInputStream()
80       */
81      public InputStream getInputStream() {
82          // TODO Auto-generated method stub
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         // TODO Auto-generated method stub
101         return null;
102     }
103 
104 }