Source Code Cross Referenced for Command.java in  » 6.0-JDK-Modules » j2me » com » sun » cldchi » tools » memoryprofiler » jdwp » 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 » 6.0 JDK Modules » j2me » com.sun.cldchi.tools.memoryprofiler.jdwp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package com.sun.cldchi.tools.memoryprofiler.jdwp;
028:
029:        /**
030:         * This class encapsulates JDWP command. Its superclass
031:         * is <code>Packet</code> so it's based on <code>ByteBuffer</code>.
032:         * The class allows to set and get JDWP command number and automatically
033:         * assign command ID. The typical use of <code>Command</code> class is
034:         * as follows:
035:         * <ul>
036:         * <li> Create a new command object with specified command number
037:         * <li> Fill command's data using standard <code>ByteBuffer</code>
038:         * and <code>Packet</code> methods (for example, <code>addInt()</code> or
039:         * <code>addReferenceTypeID()</code>)
040:         * <li> Execute command using <code>BackEndTest.checkReplyF()</code>,
041:         * <code>BackEndTest.sendCommand()</code> or
042:         * <code>BackEndTest.checkReply()</code>
043:         * <li> Work with received <code>Reply</code> object if needed
044:         * </ul>
045:         *
046:         * @see jdwp.Packet
047:         * @see jdwp.ByteBuffer
048:         * @see jdwp.BackEndTest#checkReplyF(jdwp.Command)
049:         * @see jdwp.BackEndTest#sendCommand(jdwp.Command)
050:         * @see jdwp.BackEndTest#checkReply(jdwp.Command)
051:         * @see jdwp.Reply
052:         *
053:         */
054:        class Command extends Packet {
055:
056:            /**
057:             * ID of next command. Each JDWP command must have
058:             * unique ID. The simplest way (that is used here) for generating
059:             * these IDs is a incremental counter. So this variable is incremented
060:             * after creating of each command and contains ID of next command.
061:             */
062:            private static int nextID = 1;
063:
064:            /**
065:             * Creates a new <code>Command</code> object, assign an unique ID,
066:             * the specified command number and sets flags to <code>flNoFlags</code>.
067:             * Command number is two-byte integer where hi-order byte specifies the
068:             * JDWP command set and low-order byte specifies the command number in the
069:             * command set. For example, ArrayReference/GetValues JDWP command has a
070:             * number <code>0x0D02</code> where <code>0x0D = 14</code> is a number
071:             * of ArrayReference command set and <code>0x02</code> is a number of
072:             * GetValues command in this command set. For information about numbers
073:             * of specific commands and command sets see JDWP specification.
074:             *
075:             * @param command a command number for this command
076:             */
077:            public Command(int command) {
078:                super ();
079:                setID(nextID++);
080:                setFlags(flNoFlags);
081:                setCommand(command);
082:            }
083:
084:            /**
085:             * Gets number of the command assigned for this object. For information
086:             * about command numbers see description of the constructor.
087:             *
088:             * I suspect this method is not used currently by KJDB
089:             *
090:             * @return a command number
091:             */
092:            public int getCommand() {
093:                int id = 0;
094:
095:                try {
096:                    id = (int) getID(CommandOffset, 2);
097:                } catch (BoundException e) {
098:                }
099:                ;
100:                return id;
101:            }
102:
103:            /**
104:             * Assign a command number to the object. For information
105:             * about command numbers see description of the constructor.
106:             * This method is used internally by constructor.
107:             *
108:             * @param command a command number to be assigned
109:             */
110:            public void setCommand(int command) {
111:                try {
112:                    putID(CommandOffset, command, 2);
113:                } catch (BoundException e) {
114:                }
115:                ;
116:            }
117:
118:            /**
119:             * Returns string representation of the object. This method is invoked
120:             * when reply packet of the command is not received (usually it's a
121:             * fatal error). It's useful for locating the problem.
122:             *
123:             * @return a string representation of the object
124:             */
125:            public String toString() {
126:
127:                int l = 0;
128:                try {
129:                    l = getInt(LengthOffset);
130:                } catch (BoundException e) {
131:                }
132:                ;
133:
134:                return "length     " + Tools.Hex(l, 8) + "\n" + "id         "
135:                        + Tools.Hex(getID(), 8) + "\n" + "flags      "
136:                        + Tools.Hex(getFlags(), 2) + "\n" + "command    "
137:                        + Tools.Hex(getCommand(), 4) + "\n"
138:                        + super .toString(PacketHeaderSize);
139:            }
140:
141:            /**
142:             * Returns the ID of the command last created. I think that
143:             * this method is not used currently by KJDB.
144:             *
145:             * @return ID of last command
146:             */
147:            public static int getLastID() {
148:                return (nextID - 1);
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.