KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdi > internal > ShortValueImpl


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdi.internal;
12
13
14 import java.io.DataInputStream JavaDoc;
15 import java.io.DataOutputStream JavaDoc;
16 import java.io.IOException JavaDoc;
17
18 import org.eclipse.jdi.internal.jdwp.JdwpID;
19
20 import com.sun.jdi.ShortValue;
21 import com.sun.jdi.Type;
22
23 /**
24  * this class implements the corresponding interfaces
25  * declared by the JDI specification. See the com.sun.jdi package
26  * for more information.
27  *
28  */

29 public class ShortValueImpl extends PrimitiveValueImpl implements ShortValue {
30     /** JDWP Tag. */
31     public static final byte tag = JdwpID.SHORT_TAG;
32
33     /**
34      * Creates new instance.
35      */

36     public ShortValueImpl(VirtualMachineImpl vmImpl, Short JavaDoc value) {
37         super("ShortValue", vmImpl, value); //$NON-NLS-1$
38
}
39     
40     /**
41      * @returns tag.
42      */

43     public byte getTag() {
44         return tag;
45     }
46
47     /**
48      * @returns type of value.
49      */

50     public Type type() {
51         return virtualMachineImpl().getShortType();
52     }
53
54     /**
55      * @returns Value.
56      */

57     public short value() {
58         return shortValue();
59     }
60     
61     /**
62      * @return Reads and returns new instance.
63      */

64     public static ShortValueImpl read(MirrorImpl target, DataInputStream JavaDoc in) throws IOException JavaDoc {
65         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
66         short value = target.readShort("shortValue", in); //$NON-NLS-1$
67
return new ShortValueImpl(vmImpl, new Short JavaDoc(value));
68     }
69     
70     /**
71      * Writes value without value tag.
72      */

73     public void write(MirrorImpl target, DataOutputStream JavaDoc out) throws IOException JavaDoc {
74         target.writeShort(((Short JavaDoc)fValue).shortValue(), "shortValue", out); //$NON-NLS-1$
75
}
76 }
77
Popular Tags