Source Code Cross Referenced for LocalVariableInfo.java in  » Development » javaguard » net » sf » javaguard » classfile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » javaguard » net.sf.javaguard.classfile 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JavaGuard -- an obfuscation package for Java classfiles.
003:         *
004:         * Copyright (c) 1999 Mark Welsh (markw@retrologic.com)
005:         * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2 of the License, or (at your option) any later version.
011:         *
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         *
021:         * The author may be contacted at theit@gmx.de.
022:         *
023:         *
024:         * $Id: LocalVariableInfo.java,v 1.2 2002/05/08 11:53:42 glurk Exp $
025:         */package net.sf.javaguard.classfile;
026:
027:        import java.io.*;
028:
029:        /** Representation of a local variable table entry.
030:         *
031:         * @author <a href="mailto:theit@gmx.de">Thorsten Heit</a>
032:         * @author <a href="mailto:markw@retrologic.com">Mark Welsh</a>
033:         */
034:        public class LocalVariableInfo {
035:            /** Start of the Program Counter (PC). */
036:            private int startPc;
037:            /** The length. */
038:            private int length;
039:            /** Name index into the constant pool. */
040:            private int nameIndex;
041:            /** Descriptor index into the constant pool. */
042:            private int descriptorIndex;
043:            /** Index into the constant pool. */
044:            private int index;
045:
046:            /** Creates a new LocalVariableInfo object from the given input stream.
047:             * @param din the input stream
048:             * @return the LocalVariableInfo object created from the input stream
049:             * @throws IOException if an I/O error occurs
050:             */
051:            public static LocalVariableInfo create(DataInput din)
052:                    throws IOException {
053:                LocalVariableInfo lvi = new LocalVariableInfo();
054:                lvi.read(din);
055:                return lvi;
056:            }
057:
058:            /** Private constructor that creates a new LocalVariableInfo object.
059:             */
060:            private LocalVariableInfo() {
061:            }
062:
063:            /** Sets the address of the program counter.
064:             * @param pc the address of the program counter
065:             * @see #getStartPc
066:             */
067:            protected void setStartPc(int pc) {
068:                this .startPc = pc;
069:            }
070:
071:            /** Returns the address of the program counter.
072:             * @return address of the program counter
073:             * @see #setStartPc
074:             */
075:            protected int getStartPc() {
076:                return startPc;
077:            }
078:
079:            /**  Sets the length.
080:             * @param len the length
081:             * @see #getLength
082:             */
083:            protected void setLength(int len) {
084:                this .length = len;
085:            }
086:
087:            /** Returns the length.
088:             * @return length
089:             * @see #setLength
090:             */
091:            protected int getLength() {
092:                return length;
093:            }
094:
095:            /** Set the name index.
096:             * @param index index into the constant pool
097:             * @see #getNameIndex
098:             */
099:            protected void setNameIndex(int index) {
100:                nameIndex = index;
101:            }
102:
103:            /** Return the name index into the constant pool.
104:             * @return index into the constant pool
105:             * @see #setNameIndex
106:             */
107:            protected int getNameIndex() {
108:                return nameIndex;
109:            }
110:
111:            /** Set the descriptor index.
112:             * @param index index into the constant pool
113:             * @see #getDescriptorIndex
114:             */
115:            protected void setDescriptorIndex(int index) {
116:                descriptorIndex = index;
117:            }
118:
119:            /** Return the descriptor index into constant pool.
120:             * @return index into the constant pool
121:             * @see #setDescriptorIndex
122:             */
123:            protected int getDescriptorIndex() {
124:                return descriptorIndex;
125:            }
126:
127:            /** Set the index.
128:             * @param index index into the constant pool
129:             * @see #getIndex
130:             */
131:            protected void setIndex(int index) {
132:                this .index = index;
133:            }
134:
135:            /** Return the index into the constant pool.
136:             * @return index into the constant pool
137:             * @see #setIndex
138:             */
139:            protected int getIndex() {
140:                return index;
141:            }
142:
143:            /** Check for Utf8 references to constant pool and mark them.
144:             * @param pool the constant pool the element belongs to
145:             */
146:            protected void markUtf8Refs(ConstantPool pool) {
147:                pool.incRefCount(getNameIndex());
148:                pool.incRefCount(getDescriptorIndex());
149:            }
150:
151:            /** Read the data following the header.
152:             * @param din the input stream
153:             * @throws IOException if an I/O error occurs
154:             */
155:            private void read(DataInput din) throws IOException {
156:                setStartPc(din.readUnsignedShort());
157:                setLength(din.readUnsignedShort());
158:                setNameIndex(din.readUnsignedShort());
159:                setDescriptorIndex(din.readUnsignedShort());
160:                setIndex(din.readUnsignedShort());
161:            }
162:
163:            /** Export data following the header to a DataOutput stream.
164:             * @param dout the output stream
165:             * @throws IOException if an I/O error occurs
166:             */
167:            public void write(DataOutput dout) throws IOException {
168:                dout.writeShort(getStartPc());
169:                dout.writeShort(getLength());
170:                dout.writeShort(getNameIndex());
171:                dout.writeShort(getDescriptorIndex());
172:                dout.writeShort(getIndex());
173:            }
174:
175:            /** Dump the content of the entry to the specified file (used for debugging).
176:             * @param pw the print writer
177:             * @param cf the class file the element belongs to
178:             */
179:            public void dump(PrintWriter pw, ClassFile cf) {
180:                pw.print("StartPC:          ");
181:                pw.println(getStartPc());
182:                pw.print("Length:           ");
183:                pw.println(getLength());
184:                pw.print("Name index:       ");
185:                pw.println(getNameIndex());
186:                pw.print("Descriptor index: ");
187:                pw.println(getDescriptorIndex());
188:                pw.print("Index:            ");
189:                pw.println(getIndex());
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.