KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > javaguard > FileEntry


1 /**
2  * JavaGuard -- an obfuscation package for Java classfiles.
3  *
4  * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * The author may be contacted at theit@gmx.de.
21  *
22  *
23  * $Id: FileEntry.java,v 1.1 2002/05/27 11:11:32 glurk Exp $
24  */

25 package net.sf.javaguard;
26
27
28 import java.io.DataInputStream JavaDoc;
29
30
31 /** A simple data structure that holds a file entry. It contains the necessary
32  * informations for the obfuscator so that it can read the file and access some
33  * attributes of the file.
34  * <p />
35  * File entries are normally created by implementations of {@link FileContainer}
36  * so that the obfuscator doesn't have to deal with the real location of a
37  * certain file; i.e. to distinguish between files taken from a Jar file or
38  * from a local directory.
39  */

40 public class FileEntry {
41   /** Holds the input stream for the file entry. */
42   private DataInputStream JavaDoc dis;
43   /** True if the entry specifies a class file; false else. */
44   private boolean isClassFile;
45   /** Holds the name for the file entry. */
46   private String JavaDoc name;
47   /** Holds the size of the file. */
48   private long size;
49   
50   
51   /** Default constructor that creates a new file entry.
52    * @param dis the data input stream for the file entry
53    * @param name the name for the file entry
54    * @param isClassFile true if the entry specifies a class file; false else
55    * @param size the size of the file the entry specifies
56    */

57   public FileEntry(DataInputStream JavaDoc dis, String JavaDoc name, boolean isClassFile, long size) {
58     this.dis = dis;
59     this.name = name;
60     this.isClassFile = isClassFile;
61     this.size = size;
62   }
63   
64   
65   /** Returns the data input stream for the file entry.
66    * @return data input stream for the file entry
67    */

68   public DataInputStream JavaDoc getInputStream() {
69     return dis;
70   }
71   
72   
73   /** Returns the name for the file entry.
74    * @return the name for the file entry
75    */

76   public String JavaDoc getName() {
77     return name;
78   }
79   
80   
81   /** Returns whether the entry specifies a class file.
82    * @return true if the entry specifies a class file; false else
83    */

84   public boolean isClassFile() {
85     return isClassFile;
86   }
87   
88   
89   /** Returns the size of the file the entry specifies.
90    * @return size of the file
91    */

92   public long getSize() {
93     return size;
94   }
95 }
96
Popular Tags