01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdi.internal;
11:
12: import java.io.DataInputStream;
13: import java.io.DataOutputStream;
14: import java.io.IOException;
15:
16: import org.eclipse.jdi.internal.jdwp.JdwpID;
17:
18: import com.sun.jdi.ByteValue;
19: import com.sun.jdi.Type;
20:
21: /**
22: * this class implements the corresponding interfaces
23: * declared by the JDI specification. See the com.sun.jdi package
24: * for more information.
25: *
26: */
27: public class ByteValueImpl extends PrimitiveValueImpl implements
28: ByteValue {
29: /** JDWP Tag. */
30: public static final byte tag = JdwpID.BYTE_TAG;
31:
32: /**
33: * Creates new instance.
34: */
35: public ByteValueImpl(VirtualMachineImpl vmImpl, Byte value) {
36: super ("ByteValue", vmImpl, value); //$NON-NLS-1$
37: }
38:
39: /**
40: * @returns tag.
41: */
42: public byte getTag() {
43: return tag;
44: }
45:
46: /**
47: * @returns type of value.
48: */
49: public Type type() {
50: return virtualMachineImpl().getByteType();
51: }
52:
53: /**
54: * @returns Value.
55: */
56: public byte value() {
57: return byteValue();
58: }
59:
60: /**
61: * @return Reads and returns new instance.
62: */
63: public static ByteValueImpl read(MirrorImpl target,
64: DataInputStream in) throws IOException {
65: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
66: byte value = target.readByte("byteValue", in); //$NON-NLS-1$
67: return new ByteValueImpl(vmImpl, new Byte(value));
68: }
69:
70: /**
71: * Writes value without value tag.
72: */
73: public void write(MirrorImpl target, DataOutputStream out)
74: throws IOException {
75: target.writeByte(((Byte) fValue).byteValue(), "byteValue", out); //$NON-NLS-1$
76: }
77: }
|