KickJava   Java API By Example, From Geeks To Geeks.

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


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.LongValue;
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 LongValueImpl extends PrimitiveValueImpl implements LongValue {
30     /** JDWP Tag. */
31     public static final byte tag = JdwpID.LONG_TAG;
32
33     /**
34      * Creates new instance.
35      */

36     public LongValueImpl(VirtualMachineImpl vmImpl, Long JavaDoc value) {
37         super("LongValue", 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().getLongType();
52     }
53
54     /**
55      * @returns Value.
56      */

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

64     public static LongValueImpl read(MirrorImpl target, DataInputStream JavaDoc in) throws IOException JavaDoc {
65         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
66         long value = target.readLong("longValue", in); //$NON-NLS-1$
67
return new LongValueImpl(vmImpl, new Long 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.writeLong(((Long JavaDoc)fValue).longValue(), "longValue", out); //$NON-NLS-1$
75
}
76 }
77
Popular Tags