01: /**
02: * JavaGuard -- an obfuscation package for Java classfiles.
03: *
04: * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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: */package net.sf.javaguard;
25:
26: import java.io.DataInputStream;
27:
28: /** A simple data structure that holds a file entry. It contains the necessary
29: * informations for the obfuscator so that it can read the file and access some
30: * attributes of the file.
31: * <p />
32: * File entries are normally created by implementations of {@link FileContainer}
33: * so that the obfuscator doesn't have to deal with the real location of a
34: * certain file; i.e. to distinguish between files taken from a Jar file or
35: * from a local directory.
36: */
37: public class FileEntry {
38: /** Holds the input stream for the file entry. */
39: private DataInputStream dis;
40: /** True if the entry specifies a class file; false else. */
41: private boolean isClassFile;
42: /** Holds the name for the file entry. */
43: private String name;
44: /** Holds the size of the file. */
45: private long size;
46:
47: /** Default constructor that creates a new file entry.
48: * @param dis the data input stream for the file entry
49: * @param name the name for the file entry
50: * @param isClassFile true if the entry specifies a class file; false else
51: * @param size the size of the file the entry specifies
52: */
53: public FileEntry(DataInputStream dis, String name,
54: boolean isClassFile, long size) {
55: this .dis = dis;
56: this .name = name;
57: this .isClassFile = isClassFile;
58: this .size = size;
59: }
60:
61: /** Returns the data input stream for the file entry.
62: * @return data input stream for the file entry
63: */
64: public DataInputStream getInputStream() {
65: return dis;
66: }
67:
68: /** Returns the name for the file entry.
69: * @return the name for the file entry
70: */
71: public String getName() {
72: return name;
73: }
74:
75: /** Returns whether the entry specifies a class file.
76: * @return true if the entry specifies a class file; false else
77: */
78: public boolean isClassFile() {
79: return isClassFile;
80: }
81:
82: /** Returns the size of the file the entry specifies.
83: * @return size of the file
84: */
85: public long getSize() {
86: return size;
87: }
88: }
|