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.event;
11:
12: import java.io.DataInputStream;
13: import java.io.IOException;
14:
15: import org.eclipse.jdi.internal.MirrorImpl;
16: import org.eclipse.jdi.internal.TypeImpl;
17: import org.eclipse.jdi.internal.VirtualMachineImpl;
18: import org.eclipse.jdi.internal.request.RequestID;
19:
20: import com.sun.jdi.event.ClassUnloadEvent;
21:
22: /**
23: * this class implements the corresponding interfaces
24: * declared by the JDI specification. See the com.sun.jdi package
25: * for more information.
26: *
27: */
28: public class ClassUnloadEventImpl extends EventImpl implements
29: ClassUnloadEvent {
30: /** Jdwp Event Kind. */
31: public static final byte EVENT_KIND = EVENT_CLASS_UNLOAD;
32:
33: /** Type signature. */
34: private String fSignature;
35:
36: /**
37: * Creates new ClassUnloadEventImpl.
38: */
39: private ClassUnloadEventImpl(VirtualMachineImpl vmImpl,
40: RequestID requestID) {
41: super ("ClassUnloadEvent", vmImpl, requestID); //$NON-NLS-1$
42: }
43:
44: /**
45: * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
46: */
47: public static ClassUnloadEventImpl read(MirrorImpl target,
48: RequestID requestID, DataInputStream dataInStream)
49: throws IOException {
50: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
51: ClassUnloadEventImpl event = new ClassUnloadEventImpl(vmImpl,
52: requestID);
53: event.fSignature = target.readString("signature", dataInStream); //$NON-NLS-1$
54: // Remove the class from classes that are known by the application to be loaded in the VM.
55: vmImpl.removeKnownRefType(event.fSignature);
56: return event;
57: }
58:
59: /**
60: * @return Returns the name of the class that has been unloaded.
61: */
62: public String className() {
63: return TypeImpl.signatureToName(fSignature);
64: }
65:
66: /**
67: * @return Returns the JNI-style signature of the class that has been unloaded.
68: */
69: public String classSignature() {
70: return fSignature;
71: }
72: }
|